svn commit: r368675 - in stable/11: lib/libmt usr.bin/mt

2020-12-15 Thread Kenneth D. Merry
Author: ken
Date: Tue Dec 15 20:02:40 2020
New Revision: 368675
URL: https://svnweb.freebsd.org/changeset/base/368675

Log:
  MFC r368525:

r368525 | ken | 2020-12-10 16:06:06 -0500 (Thu, 10 Dec 2020) | 17 lines
  
Add the LTO-9 density code to libmt and the mt(1) man page.
  
These values are taken directly from the density report from an
IBM LTO-9 tape drive.  (Using mt getdensity)
  
A LTO-9 drive stores 18TB raw (45TB with compression) on an LTO-9 tape.
  
lib/libmt/mtlib.c:
Add the LTO-9 density code, and bpmm/bpi values.
  
usr.bin/mt/mt.1:
Add the LTO-9 density code, bpmm/bpi values and number of
tracks.  Bump the man page date.
  

  Sponsored by: Spectra Logic

Modified:
  stable/11/lib/libmt/mtlib.c
  stable/11/usr.bin/mt/mt.1

Modified: stable/11/lib/libmt/mtlib.c
==
--- stable/11/lib/libmt/mtlib.c Tue Dec 15 19:59:29 2020(r368674)
+++ stable/11/lib/libmt/mtlib.c Tue Dec 15 20:02:40 2020(r368675)
@@ -648,6 +648,7 @@ static struct densities {
{ 0x5C, 19107,  485318, "LTO-7" },
{ 0x5D, 19107,  485318, "LTO-M8" },
{ 0x5E, 20669,  524993, "LTO-8" },
+   { 0x60, 23031,  584987, "LTO-9" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },

Modified: stable/11/usr.bin/mt/mt.1
==
--- stable/11/usr.bin/mt/mt.1   Tue Dec 15 19:59:29 2020(r368674)
+++ stable/11/usr.bin/mt/mt.1   Tue Dec 15 20:02:40 2020(r368675)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd March 4, 2019
+.Dd December 10, 2020
 .Dt MT 1
 .Os
 .Sh NAME
@@ -525,6 +525,7 @@ Value  WidthTracksDensity Code Typ
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
 0x5D   12.7  (0.5) 5376  19,107 (485,318)   C   LTO-M8   14
 0x5E   12.7  (0.5) 6656  20,669 (524,993)   C   LTO-8
+0x60   12.7  (0.5) 8960  23,031 (584,987)   C   LTO-9
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r368674 - in stable/12: lib/libmt usr.bin/mt

2020-12-15 Thread Kenneth D. Merry
Author: ken
Date: Tue Dec 15 19:59:29 2020
New Revision: 368674
URL: https://svnweb.freebsd.org/changeset/base/368674

Log:
  MFC r368525:

r368525 | ken | 2020-12-10 16:06:06 -0500 (Thu, 10 Dec 2020) | 17 lines
  
Add the LTO-9 density code to libmt and the mt(1) man page.
  
These values are taken directly from the density report from an
IBM LTO-9 tape drive.  (Using mt getdensity)
  
A LTO-9 drive stores 18TB raw (45TB with compression) on an LTO-9 tape.
  
lib/libmt/mtlib.c:
Add the LTO-9 density code, and bpmm/bpi values.
  
usr.bin/mt/mt.1:
Add the LTO-9 density code, bpmm/bpi values and number of
tracks.  Bump the man page date.
  

  Sponsored by: Spectra Logic

Modified:
  stable/12/lib/libmt/mtlib.c
  stable/12/usr.bin/mt/mt.1
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libmt/mtlib.c
==
--- stable/12/lib/libmt/mtlib.c Tue Dec 15 19:38:16 2020(r368673)
+++ stable/12/lib/libmt/mtlib.c Tue Dec 15 19:59:29 2020(r368674)
@@ -648,6 +648,7 @@ static struct densities {
{ 0x5C, 19107,  485318, "LTO-7" },
{ 0x5D, 19107,  485318, "LTO-M8" },
{ 0x5E, 20669,  524993, "LTO-8" },
+   { 0x60, 23031,  584987, "LTO-9" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },

Modified: stable/12/usr.bin/mt/mt.1
==
--- stable/12/usr.bin/mt/mt.1   Tue Dec 15 19:38:16 2020(r368673)
+++ stable/12/usr.bin/mt/mt.1   Tue Dec 15 19:59:29 2020(r368674)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd March 4, 2019
+.Dd December 10, 2020
 .Dt MT 1
 .Os
 .Sh NAME
@@ -525,6 +525,7 @@ Value  WidthTracksDensity Code Typ
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
 0x5D   12.7  (0.5) 5376  19,107 (485,318)   C   LTO-M8   14
 0x5E   12.7  (0.5) 6656  20,669 (524,993)   C   LTO-8
+0x60   12.7  (0.5) 8960  23,031 (584,987)   C   LTO-9
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r368525 - in head: lib/libmt usr.bin/mt

2020-12-10 Thread Kenneth D. Merry
Author: ken
Date: Thu Dec 10 21:06:06 2020
New Revision: 368525
URL: https://svnweb.freebsd.org/changeset/base/368525

Log:
  Add the LTO-9 density code to libmt and the mt(1) man page.
  
  These values are taken directly from the density report from an
  IBM LTO-9 tape drive.  (Using mt getdensity)
  
  A LTO-9 drive stores 18TB raw (45TB with compression) on an LTO-9 tape.
  
  lib/libmt/mtlib.c:
  Add the LTO-9 density code, and bpmm/bpi values.
  
  usr.bin/mt/mt.1:
  Add the LTO-9 density code, bpmm/bpi values and number of
tracks.  Bump the man page date.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/lib/libmt/mtlib.c
  head/usr.bin/mt/mt.1

Modified: head/lib/libmt/mtlib.c
==
--- head/lib/libmt/mtlib.c  Thu Dec 10 20:45:08 2020(r368524)
+++ head/lib/libmt/mtlib.c  Thu Dec 10 21:06:06 2020(r368525)
@@ -648,6 +648,7 @@ static struct densities {
{ 0x5C, 19107,  485318, "LTO-7" },
{ 0x5D, 19107,  485318, "LTO-M8" },
{ 0x5E, 20669,  524993, "LTO-8" },
+   { 0x60, 23031,  584987, "LTO-9" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },

Modified: head/usr.bin/mt/mt.1
==
--- head/usr.bin/mt/mt.1Thu Dec 10 20:45:08 2020(r368524)
+++ head/usr.bin/mt/mt.1Thu Dec 10 21:06:06 2020(r368525)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd March 4, 2019
+.Dd December 10, 2020
 .Dt MT 1
 .Os
 .Sh NAME
@@ -525,6 +525,7 @@ Value  WidthTracksDensity Code Typ
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
 0x5D   12.7  (0.5) 5376  19,107 (485,318)   C   LTO-M8   14
 0x5E   12.7  (0.5) 6656  20,669 (524,993)   C   LTO-8
+0x60   12.7  (0.5) 8960  23,031 (584,987)   C   LTO-9
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r363260 - head/sys/cam

2020-07-16 Thread Kenneth D. Merry
Author: ken
Date: Thu Jul 16 20:43:28 2020
New Revision: 363260
URL: https://svnweb.freebsd.org/changeset/base/363260

Log:
  Hold the mutex when releasing a callout.
  
  In xpt_release_device(), callout_stop() was being called without
  holding the mutex (send_mtx) that is used to protect the callout.
  
  So, move the mtx_unlock() call so that it is protected.
  
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Jul 16 20:36:22 2020(r363259)
+++ head/sys/cam/cam_xpt.c  Thu Jul 16 20:43:28 2020(r363260)
@@ -4959,15 +4959,17 @@ xpt_release_device(struct cam_ed *device)
devq = bus->sim->devq;
mtx_lock(>send_mtx);
cam_devq_resize(devq, devq->send_queue.array_size - 1);
-   mtx_unlock(>send_mtx);
 
KASSERT(SLIST_EMPTY(>periphs),
("destroying device, but periphs list is not empty"));
KASSERT(device->devq_entry.index == CAM_UNQUEUED_INDEX,
("destroying device while still queued for ccbs"));
 
+   /* The send_mtx must be held when accessing the callout */
if ((device->flags & CAM_DEV_REL_TIMEOUT_PENDING) != 0)
callout_stop(>callout);
+
+   mtx_unlock(>send_mtx);
 
xpt_release_target(device->target);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355863 - stable/11/sys/cam/scsi

2019-12-17 Thread Kenneth D. Merry
Author: ken
Date: Tue Dec 17 20:30:32 2019
New Revision: 355863
URL: https://svnweb.freebsd.org/changeset/base/355863

Log:
  MFC r355299:
  

r355299 | ken | 2019-12-02 14:57:39 -0500 (Mon, 02 Dec 2019) | 52 lines
  
Fix a hang introduced in r351599.
  
My changes in 351599 (kindly committed by avg) made the cd(4) media check
asynchronous to avoid a sleep while holding a mutex.
  
There was a difficult to reproduce bug with those changes that caused a
hang on boot on some single processor machines/VMs.  Leandro Lupori
managed to reproduce the bug, diagnose it, and supplied a patch!  Here is
his analysis, from the PR:
  
==
I was able to reproduce the problem described in comment#14.
  
Actually, I wasn't trying to reproduce it, I just started seeing it a few
weeks ago, in CURRENT.
  
I can reproduce it consistently, by using QEMU to run a PowerPC64 VM with a
single core/thread (-smp 1).
  
It happens only when there is no media in the emulated CD-ROM, a device
that QEMU adds by default, unless -nodefaults is specified in command line.
  
I've debugged it and this is what I've found:
  
1- After the CD probe is successful, GEOM will try to open the device,
which will end up calling cdcheckmedia(), that sets CD state to
CD_STATE_MEDIA_PREVENT.
2- Next, scsi_prevent() is executed and succeeds, the CD_FLAG_DISC_LOCKED
flag is set and CD state moves to CD_STATE_MEDIA_SIZE.
3- Next, scsi_read_capacity() is executed and fails, state is set to
CD_STATE_MEDIA_ALLOW, cdmediaprobedone() is called and wakes up
cdcheckmedia().
4- Then, when cdstart() is invoked to process CD_STATE_MEDIA_ALLOW, it
first checks if CD_FLAG_DISC_LOCKED is set, and if so skips directly to
CD_STATE_MEDIA_SIZE state. This will repeat the steps of bullet 3, entering
an infinite MEDIA_SIZE command loop.
  
When there is a least another core/thread, the GEOM thread that performed
the initial cdopen() will get scheduled again, closing the CD device, that
will call cdprevent(PR_ALLOW) that clears the CD_FLAG_DISC_LOCKED flag and
breaks the loop.
  
So, apparently, the problem is CD_STATE_MEDIA_ALLOW being skipped when
CD_FLAG_DISC_LOCKED is set. If I understand correctly, in this case, the
state should be advanced to CD_STATE_MEDIA size only when the current state
is CD_STATE_MEDIA_PREVENT.
=

  
  PR:   kern/219857
  Submitted by: Leandro Lupori 

Modified:
  stable/11/sys/cam/scsi/scsi_cd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_cd.c
==
--- stable/11/sys/cam/scsi/scsi_cd.cTue Dec 17 20:29:47 2019
(r355862)
+++ stable/11/sys/cam/scsi/scsi_cd.cTue Dec 17 20:30:32 2019
(r355863)
@@ -1009,7 +1009,8 @@ cdstart(struct cam_periph *periph, union ccb *start_cc
 * If the CD is already locked, we don't need to do this.
 * Move on to the capacity check.
 */
-   if ((softc->flags & CD_FLAG_DISC_LOCKED) != 0) {
+   if (softc->state == CD_STATE_MEDIA_PREVENT
+&& (softc->flags & CD_FLAG_DISC_LOCKED) != 0) {
softc->state = CD_STATE_MEDIA_SIZE;
xpt_release_ccb(start_ccb);
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355862 - stable/12/sys/cam/scsi

2019-12-17 Thread Kenneth D. Merry
Author: ken
Date: Tue Dec 17 20:29:47 2019
New Revision: 355862
URL: https://svnweb.freebsd.org/changeset/base/355862

Log:
  MFC r355299:
  

r355299 | ken | 2019-12-02 14:57:39 -0500 (Mon, 02 Dec 2019) | 52 lines
  
Fix a hang introduced in r351599.
  
My changes in 351599 (kindly committed by avg) made the cd(4) media check
asynchronous to avoid a sleep while holding a mutex.
  
There was a difficult to reproduce bug with those changes that caused a
hang on boot on some single processor machines/VMs.  Leandro Lupori
managed to reproduce the bug, diagnose it, and supplied a patch!  Here is
his analysis, from the PR:
  
==
I was able to reproduce the problem described in comment#14.
  
Actually, I wasn't trying to reproduce it, I just started seeing it a few
weeks ago, in CURRENT.
  
I can reproduce it consistently, by using QEMU to run a PowerPC64 VM with a
single core/thread (-smp 1).
  
It happens only when there is no media in the emulated CD-ROM, a device
that QEMU adds by default, unless -nodefaults is specified in command line.
  
I've debugged it and this is what I've found:
  
1- After the CD probe is successful, GEOM will try to open the device,
which will end up calling cdcheckmedia(), that sets CD state to
CD_STATE_MEDIA_PREVENT.
2- Next, scsi_prevent() is executed and succeeds, the CD_FLAG_DISC_LOCKED
flag is set and CD state moves to CD_STATE_MEDIA_SIZE.
3- Next, scsi_read_capacity() is executed and fails, state is set to
CD_STATE_MEDIA_ALLOW, cdmediaprobedone() is called and wakes up
cdcheckmedia().
4- Then, when cdstart() is invoked to process CD_STATE_MEDIA_ALLOW, it
first checks if CD_FLAG_DISC_LOCKED is set, and if so skips directly to
CD_STATE_MEDIA_SIZE state. This will repeat the steps of bullet 3, entering
an infinite MEDIA_SIZE command loop.
  
When there is a least another core/thread, the GEOM thread that performed
the initial cdopen() will get scheduled again, closing the CD device, that
will call cdprevent(PR_ALLOW) that clears the CD_FLAG_DISC_LOCKED flag and
breaks the loop.
  
So, apparently, the problem is CD_STATE_MEDIA_ALLOW being skipped when
CD_FLAG_DISC_LOCKED is set. If I understand correctly, in this case, the
state should be advanced to CD_STATE_MEDIA size only when the current state
is CD_STATE_MEDIA_PREVENT.
=

  
  PR:   kern/219857
  Submitted by: Leandro Lupori 

Modified:
  stable/12/sys/cam/scsi/scsi_cd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/scsi/scsi_cd.c
==
--- stable/12/sys/cam/scsi/scsi_cd.cTue Dec 17 19:01:09 2019
(r355861)
+++ stable/12/sys/cam/scsi/scsi_cd.cTue Dec 17 20:29:47 2019
(r355862)
@@ -1030,7 +1030,8 @@ cdstart(struct cam_periph *periph, union ccb *start_cc
 * If the CD is already locked, we don't need to do this.
 * Move on to the capacity check.
 */
-   if ((softc->flags & CD_FLAG_DISC_LOCKED) != 0) {
+   if (softc->state == CD_STATE_MEDIA_PREVENT
+&& (softc->flags & CD_FLAG_DISC_LOCKED) != 0) {
softc->state = CD_STATE_MEDIA_SIZE;
xpt_release_ccb(start_ccb);
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355299 - head/sys/cam/scsi

2019-12-02 Thread Kenneth D. Merry
Author: ken
Date: Mon Dec  2 19:57:39 2019
New Revision: 355299
URL: https://svnweb.freebsd.org/changeset/base/355299

Log:
  Fix a hang introduced in r351599.
  
  My changes in 351599 (kindly committed by avg) made the cd(4) media check
  asynchronous to avoid a sleep while holding a mutex.
  
  There was a difficult to reproduce bug with those changes that caused a
  hang on boot on some single processor machines/VMs.  Leandro Lupori
  managed to reproduce the bug, diagnose it, and supplied a patch!  Here is
  his analysis, from the PR:
  
  ==
  I was able to reproduce the problem described in comment#14.
  
  Actually, I wasn't trying to reproduce it, I just started seeing it a few
  weeks ago, in CURRENT.
  
  I can reproduce it consistently, by using QEMU to run a PowerPC64 VM with a
  single core/thread (-smp 1).
  
  It happens only when there is no media in the emulated CD-ROM, a device
  that QEMU adds by default, unless -nodefaults is specified in command line.
  
  I've debugged it and this is what I've found:
  
  1- After the CD probe is successful, GEOM will try to open the device,
  which will end up calling cdcheckmedia(), that sets CD state to
  CD_STATE_MEDIA_PREVENT.
  2- Next, scsi_prevent() is executed and succeeds, the CD_FLAG_DISC_LOCKED
  flag is set and CD state moves to CD_STATE_MEDIA_SIZE.
  3- Next, scsi_read_capacity() is executed and fails, state is set to
  CD_STATE_MEDIA_ALLOW, cdmediaprobedone() is called and wakes up
  cdcheckmedia().
  4- Then, when cdstart() is invoked to process CD_STATE_MEDIA_ALLOW, it
  first checks if CD_FLAG_DISC_LOCKED is set, and if so skips directly to
  CD_STATE_MEDIA_SIZE state. This will repeat the steps of bullet 3, entering
  an infinite MEDIA_SIZE command loop.
  
  When there is a least another core/thread, the GEOM thread that performed
  the initial cdopen() will get scheduled again, closing the CD device, that
  will call cdprevent(PR_ALLOW) that clears the CD_FLAG_DISC_LOCKED flag and
  breaks the loop.
  
  So, apparently, the problem is CD_STATE_MEDIA_ALLOW being skipped when
  CD_FLAG_DISC_LOCKED is set. If I understand correctly, in this case, the
  state should be advanced to CD_STATE_MEDIA size only when the current state
  is CD_STATE_MEDIA_PREVENT.
  =
  
  PR:   kern/219857
  Submitted by: Leandro Lupori 
  MFC after:1 week

Modified:
  head/sys/cam/scsi/scsi_cd.c

Modified: head/sys/cam/scsi/scsi_cd.c
==
--- head/sys/cam/scsi/scsi_cd.c Mon Dec  2 19:57:20 2019(r355298)
+++ head/sys/cam/scsi/scsi_cd.c Mon Dec  2 19:57:39 2019(r355299)
@@ -1032,7 +1032,8 @@ cdstart(struct cam_periph *periph, union ccb *start_cc
 * If the CD is already locked, we don't need to do this.
 * Move on to the capacity check.
 */
-   if ((softc->flags & CD_FLAG_DISC_LOCKED) != 0) {
+   if (softc->state == CD_STATE_MEDIA_PREVENT
+&& (softc->flags & CD_FLAG_DISC_LOCKED) != 0) {
softc->state = CD_STATE_MEDIA_SIZE;
xpt_release_ccb(start_ccb);
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r348483 - stable/11/sys/dev/isp

2019-05-31 Thread Kenneth D. Merry
Author: ken
Date: Fri May 31 20:36:32 2019
New Revision: 348483
URL: https://svnweb.freebsd.org/changeset/base/348483

Log:
  MFC r348247:

r348247 | ken | 2019-05-24 13:58:29 -0400 (Fri, 24 May 2019) | 57 lines
  
Fix FC-Tape bugs caused in part by r345008.
  
The point of r345008 was to reset the Command Reference Number (CRN)
in some situations where a device stayed in the topology, but had
changed somehow.
  
This can include moving from a switch connection to a direct
connection or vice versa, or a device that temporarily goes away
and comes back.  (e.g. moving to a different switch port)
  
There were a couple of bugs in that change:
- We were reporting that a device had not changed whenever the
  Establish Image Pair bit was not set.  That is not quite correct.
  Instead, if the Establish Image Pair bit stays the same (set or
  not), the device hasn't changed in that way.
  
- We weren't setting PRLI Word0 in the port database when a new
  device arrived, so comparisons with the old value for the
  Establish Image Pair bit weren't really possible.  So, make sure
  PRLI Word0 is set in the port database for new devices.
  
- We were resetting the CRN whenever the Establish Image Pair bit
  was set for a device, even when the device had stayed the same
  and the value of the bit hadn't changed.  Now, only reset the
  CRN for devices that have changed, not devices that sayed the
  same.
  
The result of all of this was that if we had a single FC device on
an FC port and it went away and came back, we would wind up
correctly resetting the CRN.
  
But, if we had multiple devices connected via a switch, and there
was any change in one or more of those devices, all of the devices
that stayed the same would also have their CRN values reset.
  
The result, from a user standpoint, is that the tape drives, etc.
would all start to time out commands and the initiator would send
aborts.
  
sys/dev/isp/isp.c:
In isp_pdb_add_update(), look at whether the Establish
Image Pair bit has changed as part of the check to
determine whether a device is still the same.   This was
causing erroneous change notifications.  Also, when
creating a new port database entry, initialize the
PRLI Word 0 values.
  
sys/dev/isp/isp_freebsd.c:
In isp_async(), in the changed/stayed case, instead of
looking at the Establish Image Pair bit to determine
whether to reset the CRN, look at the command value.
(Changed vs. Stayed.)  Only reset the CRN for devices
that have changed.

  
  Sponsored by: Spectra Logic
  Approved by:  re (gjb)

Modified:
  stable/11/sys/dev/isp/isp.c
  stable/11/sys/dev/isp/isp_freebsd.c

Modified: stable/11/sys/dev/isp/isp.c
==
--- stable/11/sys/dev/isp/isp.c Fri May 31 20:26:56 2019(r348482)
+++ stable/11/sys/dev/isp/isp.c Fri May 31 20:36:32 2019(r348483)
@@ -3249,7 +3249,8 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_
if (lp->portid == pdb->portid &&
lp->handle == pdb->handle &&
lp->prli_word3 == pdb->prli_word3 &&
-   ((pdb->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) == 0)) {
+   ((pdb->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) ==
+(lp->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR))) {
if (lp->state != FC_PORTDB_STATE_NEW)
lp->state = FC_PORTDB_STATE_VALID;
isp_prt(isp, ISP_LOG_SANCFG,
@@ -3280,6 +3281,7 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_
lp->probational = 0;
lp->state = FC_PORTDB_STATE_NEW;
lp->portid = lp->new_portid = pdb->portid;
+   lp->prli_word0 = lp->new_prli_word0 = pdb->prli_word0;
lp->prli_word3 = lp->new_prli_word3 = pdb->prli_word3;
lp->handle = pdb->handle;
lp->port_wwn = wwpn;

Modified: stable/11/sys/dev/isp/isp_freebsd.c
==
--- stable/11/sys/dev/isp/isp_freebsd.c Fri May 31 20:26:56 2019
(r348482)
+++ stable/11/sys/dev/isp/isp_freebsd.c Fri May 31 20:36:32 2019
(r348483)
@@ -3787,7 +3787,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
xpt_async(AC_CONTRACT, fc->path, );
}
 
-   if ((lp->new_prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) &&
+   if ((cmd == ISPASYNC_DEV_CHANGED) &&
(crn_reset_done == 0))
isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1);
 

svn commit: r348480 - stable/12/sys/dev/isp

2019-05-31 Thread Kenneth D. Merry
Author: ken
Date: Fri May 31 20:15:29 2019
New Revision: 348480
URL: https://svnweb.freebsd.org/changeset/base/348480

Log:
  MFC r348247:

r348247 | ken | 2019-05-24 13:58:29 -0400 (Fri, 24 May 2019) | 57 lines
  
Fix FC-Tape bugs caused in part by r345008.
  
The point of r345008 was to reset the Command Reference Number (CRN)
in some situations where a device stayed in the topology, but had
changed somehow.
  
This can include moving from a switch connection to a direct
connection or vice versa, or a device that temporarily goes away
and comes back.  (e.g. moving to a different switch port)
  
There were a couple of bugs in that change:
- We were reporting that a device had not changed whenever the
  Establish Image Pair bit was not set.  That is not quite correct.
  Instead, if the Establish Image Pair bit stays the same (set or
  not), the device hasn't changed in that way.
  
- We weren't setting PRLI Word0 in the port database when a new
  device arrived, so comparisons with the old value for the
  Establish Image Pair bit weren't really possible.  So, make sure
  PRLI Word0 is set in the port database for new devices.
  
- We were resetting the CRN whenever the Establish Image Pair bit
  was set for a device, even when the device had stayed the same
  and the value of the bit hadn't changed.  Now, only reset the
  CRN for devices that have changed, not devices that sayed the
  same.
  
The result of all of this was that if we had a single FC device on
an FC port and it went away and came back, we would wind up
correctly resetting the CRN.
  
But, if we had multiple devices connected via a switch, and there
was any change in one or more of those devices, all of the devices
that stayed the same would also have their CRN values reset.
  
The result, from a user standpoint, is that the tape drives, etc.
would all start to time out commands and the initiator would send
aborts.
  
sys/dev/isp/isp.c:
In isp_pdb_add_update(), look at whether the Establish
Image Pair bit has changed as part of the check to
determine whether a device is still the same.   This was
causing erroneous change notifications.  Also, when
creating a new port database entry, initialize the
PRLI Word 0 values.
  
sys/dev/isp/isp_freebsd.c:
In isp_async(), in the changed/stayed case, instead of
looking at the Establish Image Pair bit to determine
whether to reset the CRN, look at the command value.
(Changed vs. Stayed.)  Only reset the CRN for devices
that have changed.
  

  
  Sponsored by: Spectra Logic

Modified:
  stable/12/sys/dev/isp/isp.c
  stable/12/sys/dev/isp/isp_freebsd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/isp/isp.c
==
--- stable/12/sys/dev/isp/isp.c Fri May 31 19:13:31 2019(r348479)
+++ stable/12/sys/dev/isp/isp.c Fri May 31 20:15:29 2019(r348480)
@@ -3251,7 +3251,8 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_
if (lp->portid == pdb->portid &&
lp->handle == pdb->handle &&
lp->prli_word3 == pdb->prli_word3 &&
-   ((pdb->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) == 0)) {
+   ((pdb->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) ==
+(lp->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR))) {
if (lp->state != FC_PORTDB_STATE_NEW)
lp->state = FC_PORTDB_STATE_VALID;
isp_prt(isp, ISP_LOG_SANCFG,
@@ -3282,6 +3283,7 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_
lp->probational = 0;
lp->state = FC_PORTDB_STATE_NEW;
lp->portid = lp->new_portid = pdb->portid;
+   lp->prli_word0 = lp->new_prli_word0 = pdb->prli_word0;
lp->prli_word3 = lp->new_prli_word3 = pdb->prli_word3;
lp->handle = pdb->handle;
lp->port_wwn = wwpn;

Modified: stable/12/sys/dev/isp/isp_freebsd.c
==
--- stable/12/sys/dev/isp/isp_freebsd.c Fri May 31 19:13:31 2019
(r348479)
+++ stable/12/sys/dev/isp/isp_freebsd.c Fri May 31 20:15:29 2019
(r348480)
@@ -3789,7 +3789,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
xpt_async(AC_CONTRACT, fc->path, );
}
 
-   if ((lp->new_prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) &&
+   if ((cmd == ISPASYNC_DEV_CHANGED) &&
(crn_reset_done == 0))
isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1);
 

svn commit: r348247 - head/sys/dev/isp

2019-05-24 Thread Kenneth D. Merry
Author: ken
Date: Fri May 24 17:58:29 2019
New Revision: 348247
URL: https://svnweb.freebsd.org/changeset/base/348247

Log:
  Fix FC-Tape bugs caused in part by r345008.
  
  The point of r345008 was to reset the Command Reference Number (CRN)
  in some situations where a device stayed in the topology, but had
  changed somehow.
  
  This can include moving from a switch connection to a direct
  connection or vice versa, or a device that temporarily goes away
  and comes back.  (e.g. moving to a different switch port)
  
  There were a couple of bugs in that change:
  - We were reporting that a device had not changed whenever the
Establish Image Pair bit was not set.  That is not quite correct.
Instead, if the Establish Image Pair bit stays the same (set or
not), the device hasn't changed in that way.
  
  - We weren't setting PRLI Word0 in the port database when a new
device arrived, so comparisons with the old value for the
Establish Image Pair bit weren't really possible.  So, make sure
PRLI Word0 is set in the port database for new devices.
  
  - We were resetting the CRN whenever the Establish Image Pair bit
was set for a device, even when the device had stayed the same
and the value of the bit hadn't changed.  Now, only reset the
CRN for devices that have changed, not devices that sayed the
same.
  
  The result of all of this was that if we had a single FC device on
  an FC port and it went away and came back, we would wind up
  correctly resetting the CRN.
  
  But, if we had multiple devices connected via a switch, and there
  was any change in one or more of those devices, all of the devices
  that stayed the same would also have their CRN values reset.
  
  The result, from a user standpoint, is that the tape drives, etc.
  would all start to time out commands and the initiator would send
  aborts.
  
  sys/dev/isp/isp.c:
In isp_pdb_add_update(), look at whether the Establish
Image Pair bit has changed as part of the check to
determine whether a device is still the same.   This was
causing erroneous change notifications.  Also, when
creating a new port database entry, initialize the
PRLI Word 0 values.
  
  sys/dev/isp/isp_freebsd.c:
In isp_async(), in the changed/stayed case, instead of
looking at the Establish Image Pair bit to determine
whether to reset the CRN, look at the command value.
(Changed vs. Stayed.)  Only reset the CRN for devices
that have changed.
  
  Sponsored by: Spectra Logic
  MFC after:3 days

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Fri May 24 17:19:06 2019(r348246)
+++ head/sys/dev/isp/isp.c  Fri May 24 17:58:29 2019(r348247)
@@ -3251,7 +3251,8 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_
if (lp->portid == pdb->portid &&
lp->handle == pdb->handle &&
lp->prli_word3 == pdb->prli_word3 &&
-   ((pdb->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) == 0)) {
+   ((pdb->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) ==
+(lp->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR))) {
if (lp->state != FC_PORTDB_STATE_NEW)
lp->state = FC_PORTDB_STATE_VALID;
isp_prt(isp, ISP_LOG_SANCFG,
@@ -3282,6 +3283,7 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_
lp->probational = 0;
lp->state = FC_PORTDB_STATE_NEW;
lp->portid = lp->new_portid = pdb->portid;
+   lp->prli_word0 = lp->new_prli_word0 = pdb->prli_word0;
lp->prli_word3 = lp->new_prli_word3 = pdb->prli_word3;
lp->handle = pdb->handle;
lp->port_wwn = wwpn;

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Fri May 24 17:19:06 2019
(r348246)
+++ head/sys/dev/isp/isp_freebsd.c  Fri May 24 17:58:29 2019
(r348247)
@@ -3789,7 +3789,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
xpt_async(AC_CONTRACT, fc->path, );
}
 
-   if ((lp->new_prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) &&
+   if ((cmd == ISPASYNC_DEV_CHANGED) &&
(crn_reset_done == 0))
isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r347906 - stable/12/sys/dev/isp

2019-05-17 Thread Kenneth D. Merry
Author: ken
Date: Fri May 17 14:29:56 2019
New Revision: 347906
URL: https://svnweb.freebsd.org/changeset/base/347906

Log:
  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

Modified:
  stable/12/sys/dev/isp/isp.c
  stable/12/sys/dev/isp/isp_freebsd.c
  stable/12/sys/dev/isp/isp_stds.h
  stable/12/sys/dev/isp/ispmbox.h
  stable/12/sys/dev/isp/ispvar.h

Modified: stable/12/sys/dev/isp/isp.c
==
--- stable/12/sys/dev/isp/isp.c Fri May 17 14:09:33 2019(r347905)
+++ stable/12/sys/dev/isp/isp.c Fri May 17 14:29:56 2019(r347906)
@@ -2791,6 +2791,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp
if (IS_24XX(isp)) {
isp_get_pdb_24xx(isp, isp->isp_iocb, );
pdb->handle = un.bill.pdb_handle;
+   pdb->prli_word0 = un.bill.pdb_prli_svc0;
pdb->prli_word3 = un.bill.pdb_prli_svc3;
pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits);
ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8);
@@ -2807,6 +2808,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp
} else {
isp_get_pdb_21xx(isp, isp->isp_iocb, );
pdb->handle = un.fred.pdb_loopid;
+   pdb->prli_word0 = un.fred.pdb_prli_svc0;
pdb->prli_word3 = un.fred.pdb_prli_svc3;
pdb->portid = BITS2WORD(un.fred.pdb_portid_bits);
ISP_MEMCPY(pdb->portname, un.fred.pdb_portname, 8);
@@ -3196,6 +3198,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
lp->state = FC_PORTDB_STATE_VALID;
isp_async(isp, ISPASYNC_DEV_CHANGED, chan, lp);
lp->portid = lp->new_portid;
+   lp->prli_word0 = lp->new_prli_word0;
lp->prli_word3 = lp->new_prli_word3;
break;
case FC_PORTDB_STATE_VALID:
@@ -3247,7 +3250,8 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_
/* Old device, nothing new. */
if (lp->portid == pdb->portid &&
lp->handle == pdb->handle &&
-   lp->prli_word3 == 

svn commit: r347894 - stable/11/sys/dev/isp

2019-05-16 Thread Kenneth D. Merry
Author: ken
Date: Thu May 16 22:03:25 2019
New Revision: 347894
URL: https://svnweb.freebsd.org/changeset/base/347894

Log:
  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
  


Modified:
  stable/11/sys/dev/isp/isp.c
  stable/11/sys/dev/isp/isp_freebsd.c
  stable/11/sys/dev/isp/isp_stds.h
  stable/11/sys/dev/isp/ispmbox.h
  stable/11/sys/dev/isp/ispvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp.c
==
--- stable/11/sys/dev/isp/isp.c Thu May 16 21:50:12 2019(r347893)
+++ stable/11/sys/dev/isp/isp.c Thu May 16 22:03:25 2019(r347894)
@@ -2789,6 +2789,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp
if (IS_24XX(isp)) {
isp_get_pdb_24xx(isp, isp->isp_iocb, );
pdb->handle = un.bill.pdb_handle;
+   pdb->prli_word0 = un.bill.pdb_prli_svc0;
pdb->prli_word3 = un.bill.pdb_prli_svc3;
pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits);
ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8);
@@ -2805,6 +2806,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp
} else {
isp_get_pdb_21xx(isp, isp->isp_iocb, );
pdb->handle = un.fred.pdb_loopid;
+   pdb->prli_word0 = un.fred.pdb_prli_svc0;
pdb->prli_word3 = un.fred.pdb_prli_svc3;
pdb->portid = BITS2WORD(un.fred.pdb_portid_bits);
ISP_MEMCPY(pdb->portname, un.fred.pdb_portname, 8);
@@ -3194,6 +3196,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
lp->state = FC_PORTDB_STATE_VALID;
isp_async(isp, ISPASYNC_DEV_CHANGED, chan, lp);
lp->portid = lp->new_portid;
+   lp->prli_word0 = lp->new_prli_word0;
lp->prli_word3 = lp->new_prli_word3;
break;
case FC_PORTDB_STATE_VALID:
@@ -3245,7 +3248,8 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_
/* Old device, nothing new. */
if (lp->portid == pdb->portid &&
lp->handle == 

svn commit: r347885 - in stable/12: lib/libmt usr.bin/mt

2019-05-16 Thread Kenneth D. Merry
Author: ken
Date: Thu May 16 18:50:18 2019
New Revision: 347885
URL: https://svnweb.freebsd.org/changeset/base/347885

Log:
  MFC 344761:

r344761 | ken | 2019-03-04 09:30:37 -0500 (Mon, 04 Mar 2019) | 18 lines
  
Add IBM TS1160 density codes to libmt and the mt(1) man page.
  
These are taken directly from the density report from a TS1160
tape drive.  (Using mt getdensity)
  
A TS1160 drive stores 20TB raw (60TB with compression) on a JE tape.
  
lib/libmt/mtlib.c:
Add 3592A6 encrypted/unencrypted density codes, and bpmm/bpi
values.
  
usr.bin/mt/mt.1:
Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi
values and number of tracks.  Bump the man page date.
  
Sponsored by:   Spectra Logic
  


Modified:
  stable/12/lib/libmt/mtlib.c
  stable/12/usr.bin/mt/mt.1

Modified: stable/12/lib/libmt/mtlib.c
==
--- stable/12/lib/libmt/mtlib.c Thu May 16 18:42:27 2019(r347884)
+++ stable/12/lib/libmt/mtlib.c Thu May 16 18:50:18 2019(r347885)
@@ -642,6 +642,7 @@ static struct densities {
{ 0x54, 19686,  500024, "3592A4 (unencrypted)" },
{ 0x55, 20670,  525018, "3592A5 (unencrypted)" },
{ 0x56, 20670,  525018, "3592B5 (unencrypted)" },
+   { 0x57, 21850,  554990, "3592A6 (unencrypted)" },
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
@@ -653,6 +654,7 @@ static struct densities {
{ 0x74, 19686,  500024, "3592A4 (encrypted)" },
{ 0x75, 20670,  525018, "3592A5 (encrypted)" },
{ 0x76, 20670,  525018, "3592B5 (encrypted)" },
+   { 0x77, 21850,  554990, "3592A6 (encrypted)" },
{ 0x8c,  1789,   45434, "EXB-8500c" },
{ 0x90,  1703,   43245, "EXB-8200c" },
{ 0, 0, 0, NULL }

Modified: stable/12/usr.bin/mt/mt.1
==
--- stable/12/usr.bin/mt/mt.1   Thu May 16 18:42:27 2019(r347884)
+++ stable/12/usr.bin/mt/mt.1   Thu May 16 18:50:18 2019(r347885)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd November 3, 2017
+.Dd March 4, 2019
 .Dt MT 1
 .Os
 .Sh NAME
@@ -519,6 +519,7 @@ Value  WidthTracksDensity Code Typ
 0x54   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (unencrypted)
 0x55   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (unencrypted)
 0x56   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (unencrypted)
+0x57   12.7  (0.5) 8704  21,850 (554,990)   C   3592A6 (unencrypted)
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
@@ -530,6 +531,7 @@ Value  WidthTracksDensity Code Typ
 0x74   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (encrypted)
 0x75   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (encrypted)
 0x76   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (encrypted)
+0x77   12.7  (0.5) 8704  21,850 (554,990)   C   3592A6 (encrypted)
 0x8c8.0  (0.315)  1  1,789  (45,434)  RLL   CS  EXB-8500c5,9
 0x908.0  (0.315)  1  1,703  (43,245)  RLL   CS  EXB-8200c5,9
 .Ed
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r347884 - in stable/11: lib/libmt usr.bin/mt

2019-05-16 Thread Kenneth D. Merry
Author: ken
Date: Thu May 16 18:42:27 2019
New Revision: 347884
URL: https://svnweb.freebsd.org/changeset/base/347884

Log:
  MFC 344761:

r344761 | ken | 2019-03-04 09:30:37 -0500 (Mon, 04 Mar 2019) | 18 lines
  
Add IBM TS1160 density codes to libmt and the mt(1) man page.
  
These are taken directly from the density report from a TS1160
tape drive.  (Using mt getdensity)
  
A TS1160 drive stores 20TB raw (60TB with compression) on a JE tape.
  
lib/libmt/mtlib.c:
Add 3592A6 encrypted/unencrypted density codes, and bpmm/bpi
values.
  
usr.bin/mt/mt.1:
Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi
values and number of tracks.  Bump the man page date.
  
Sponsored by:   Spectra Logic
  


Modified:
  stable/11/lib/libmt/mtlib.c
  stable/11/usr.bin/mt/mt.1
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libmt/mtlib.c
==
--- stable/11/lib/libmt/mtlib.c Thu May 16 18:33:30 2019(r347883)
+++ stable/11/lib/libmt/mtlib.c Thu May 16 18:42:27 2019(r347884)
@@ -642,6 +642,7 @@ static struct densities {
{ 0x54, 19686,  500024, "3592A4 (unencrypted)" },
{ 0x55, 20670,  525018, "3592A5 (unencrypted)" },
{ 0x56, 20670,  525018, "3592B5 (unencrypted)" },
+   { 0x57, 21850,  554990, "3592A6 (unencrypted)" },
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
@@ -653,6 +654,7 @@ static struct densities {
{ 0x74, 19686,  500024, "3592A4 (encrypted)" },
{ 0x75, 20670,  525018, "3592A5 (encrypted)" },
{ 0x76, 20670,  525018, "3592B5 (encrypted)" },
+   { 0x77, 21850,  554990, "3592A6 (encrypted)" },
{ 0x8c,  1789,   45434, "EXB-8500c" },
{ 0x90,  1703,   43245, "EXB-8200c" },
{ 0, 0, 0, NULL }

Modified: stable/11/usr.bin/mt/mt.1
==
--- stable/11/usr.bin/mt/mt.1   Thu May 16 18:33:30 2019(r347883)
+++ stable/11/usr.bin/mt/mt.1   Thu May 16 18:42:27 2019(r347884)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd November 3, 2017
+.Dd March 4, 2019
 .Dt MT 1
 .Os
 .Sh NAME
@@ -519,6 +519,7 @@ Value  WidthTracksDensity Code Typ
 0x54   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (unencrypted)
 0x55   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (unencrypted)
 0x56   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (unencrypted)
+0x57   12.7  (0.5) 8704  21,850 (554,990)   C   3592A6 (unencrypted)
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
@@ -530,6 +531,7 @@ Value  WidthTracksDensity Code Typ
 0x74   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (encrypted)
 0x75   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (encrypted)
 0x76   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (encrypted)
+0x77   12.7  (0.5) 8704  21,850 (554,990)   C   3592A6 (encrypted)
 0x8c8.0  (0.315)  1  1,789  (45,434)  RLL   CS  EXB-8500c5,9
 0x908.0  (0.315)  1  1,703  (43,245)  RLL   CS  EXB-8200c5,9
 .Ed
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r345008 - head/sys/dev/isp

2019-03-11 Thread Kenneth D. Merry
Author: ken
Date: Mon Mar 11 14:21:14 2019
New Revision: 345008
URL: https://svnweb.freebsd.org/changeset/base/345008

Log:
  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.
  
  MFC after:1 week
  Sponsored by: Spectra Logic
  Differential Revision:https://reviews.freebsd.org/D19472

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_stds.h
  head/sys/dev/isp/ispmbox.h
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Mon Mar 11 13:56:51 2019(r345007)
+++ head/sys/dev/isp/isp.c  Mon Mar 11 14:21:14 2019(r345008)
@@ -2791,6 +2791,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp
if (IS_24XX(isp)) {
isp_get_pdb_24xx(isp, isp->isp_iocb, );
pdb->handle = un.bill.pdb_handle;
+   pdb->prli_word0 = un.bill.pdb_prli_svc0;
pdb->prli_word3 = un.bill.pdb_prli_svc3;
pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits);
ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8);
@@ -2807,6 +2808,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp
} else {
isp_get_pdb_21xx(isp, isp->isp_iocb, );
pdb->handle = un.fred.pdb_loopid;
+   pdb->prli_word0 = un.fred.pdb_prli_svc0;
pdb->prli_word3 = un.fred.pdb_prli_svc3;
pdb->portid = BITS2WORD(un.fred.pdb_portid_bits);
ISP_MEMCPY(pdb->portname, un.fred.pdb_portname, 8);
@@ -3196,6 +3198,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
lp->state = FC_PORTDB_STATE_VALID;
isp_async(isp, ISPASYNC_DEV_CHANGED, chan, lp);
lp->portid = lp->new_portid;
+   lp->prli_word0 = lp->new_prli_word0;
lp->prli_word3 = lp->new_prli_word3;
break;
case FC_PORTDB_STATE_VALID:
@@ -3247,7 +3250,8 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_
/* Old device, nothing new. */
if (lp->portid == pdb->portid &&
lp->handle == pdb->handle &&
-   lp->prli_word3 == pdb->prli_word3) {
+   lp->prli_word3 == pdb->prli_word3 &&
+   ((pdb->prli_word0 & PRLI_WD0_EST_IMAGE_PAIR) == 0)) {
if (lp->state != FC_PORTDB_STATE_NEW)
lp->state = FC_PORTDB_STATE_VALID;
isp_prt(isp, ISP_LOG_SANCFG,
@@ 

svn commit: r344761 - in head: lib/libmt usr.bin/mt

2019-03-04 Thread Kenneth D. Merry
Author: ken
Date: Mon Mar  4 14:30:37 2019
New Revision: 344761
URL: https://svnweb.freebsd.org/changeset/base/344761

Log:
  Add IBM TS1160 density codes to libmt and the mt(1) man page.
  
  These are taken directly from the density report from a TS1160
  tape drive.  (Using mt getdensity)
  
  A TS1160 drive stores 20TB raw (60TB with compression) on a JE tape.
  
  lib/libmt/mtlib.c:
Add 3592A6 encrypted/unencrypted density codes, and bpmm/bpi
values.
  
  usr.bin/mt/mt.1:
Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi
values and number of tracks.  Bump the man page date.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/lib/libmt/mtlib.c
  head/usr.bin/mt/mt.1

Modified: head/lib/libmt/mtlib.c
==
--- head/lib/libmt/mtlib.c  Mon Mar  4 13:18:04 2019(r344760)
+++ head/lib/libmt/mtlib.c  Mon Mar  4 14:30:37 2019(r344761)
@@ -642,6 +642,7 @@ static struct densities {
{ 0x54, 19686,  500024, "3592A4 (unencrypted)" },
{ 0x55, 20670,  525018, "3592A5 (unencrypted)" },
{ 0x56, 20670,  525018, "3592B5 (unencrypted)" },
+   { 0x57, 21850,  554990, "3592A6 (unencrypted)" },
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
@@ -653,6 +654,7 @@ static struct densities {
{ 0x74, 19686,  500024, "3592A4 (encrypted)" },
{ 0x75, 20670,  525018, "3592A5 (encrypted)" },
{ 0x76, 20670,  525018, "3592B5 (encrypted)" },
+   { 0x77, 21850,  554990, "3592A6 (encrypted)" },
{ 0x8c,  1789,   45434, "EXB-8500c" },
{ 0x90,  1703,   43245, "EXB-8200c" },
{ 0, 0, 0, NULL }

Modified: head/usr.bin/mt/mt.1
==
--- head/usr.bin/mt/mt.1Mon Mar  4 13:18:04 2019(r344760)
+++ head/usr.bin/mt/mt.1Mon Mar  4 14:30:37 2019(r344761)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd November 3, 2017
+.Dd March 4, 2019
 .Dt MT 1
 .Os
 .Sh NAME
@@ -519,6 +519,7 @@ Value  WidthTracksDensity Code Typ
 0x54   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (unencrypted)
 0x55   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (unencrypted)
 0x56   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (unencrypted)
+0x57   12.7  (0.5) 8704  21,850 (554,990)   C   3592A6 (unencrypted)
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
@@ -530,6 +531,7 @@ Value  WidthTracksDensity Code Typ
 0x74   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (encrypted)
 0x75   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (encrypted)
 0x76   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (encrypted)
+0x77   12.7  (0.5) 8704  21,850 (554,990)   C   3592A6 (encrypted)
 0x8c8.0  (0.315)  1  1,789  (45,434)  RLL   CS  EXB-8500c5,9
 0x908.0  (0.315)  1  1,703  (43,245)  RLL   CS  EXB-8200c5,9
 .Ed
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339336 - stable/11/sys/cam/scsi

2018-10-12 Thread Kenneth D. Merry
Author: ken
Date: Fri Oct 12 19:44:19 2018
New Revision: 339336
URL: https://svnweb.freebsd.org/changeset/base/339336

Log:
  MFC r339076
  
  This has been edited slightly from the version in head.  In head, the probe
  sections of dadone() were split out into separate functions.  In stable/11,
  dadone() is still a single function.
  
  So, for stable/11, this describes the change:
  
  sys/cam/scsi/scsi_da.c:
In the DA_CCB_PROBE_DONE case in dadone(), free the data pointer
before returning.
  

r339076 | ken | 2018-10-01 13:00:46 -0600 (Mon, 01 Oct 2018) | 12 lines
  
Fix a da(4) driver memory leak for SCSI SMR devices.
  
In the probe case for SCSI SMR Host Aware or Most Managed drives, be sure
to free allocated memory.
  
sys/cam/scsi/scsi_da.c:
In dadone_probezone(), free the data pointer before returning.
  
Sponsored by:   Spectra Logic
  

  
  Sponsored by: Spectra Logic

Modified:
  stable/11/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_da.c
==
--- stable/11/sys/cam/scsi/scsi_da.cFri Oct 12 16:55:28 2018
(r339335)
+++ stable/11/sys/cam/scsi/scsi_da.cFri Oct 12 19:44:19 2018
(r339336)
@@ -5354,6 +5354,9 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
}
}
}
+
+   free(csio->data_ptr, M_SCSIDA);
+
daprobedone(periph, done_ccb);
return;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339076 - head/sys/cam/scsi

2018-10-01 Thread Kenneth D. Merry
Author: ken
Date: Mon Oct  1 19:00:46 2018
New Revision: 339076
URL: https://svnweb.freebsd.org/changeset/base/339076

Log:
  Fix a da(4) driver memory leak for SCSI SMR devices.
  
  In the probe case for SCSI SMR Host Aware or Most Managed drives, be sure
  to free allocated memory.
  
  sys/cam/scsi/scsi_da.c:
In dadone_probezone(), free the data pointer before returning.
  
  MFC after:3 days
  Sponsored by: Spectra Logic
  Approved by:  re (kib)

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Mon Oct  1 18:51:39 2018(r339075)
+++ head/sys/cam/scsi/scsi_da.c Mon Oct  1 19:00:46 2018(r339076)
@@ -5674,6 +5674,9 @@ dadone_probezone(struct cam_periph *periph, union ccb 
}
}
}
+
+   free(csio->data_ptr, M_SCSIDA);
+
daprobedone(periph, done_ccb);
return;
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335154 - head/sys/cam/scsi

2018-06-14 Thread Kenneth D. Merry
Author: ken
Date: Thu Jun 14 17:08:44 2018
New Revision: 335154
URL: https://svnweb.freebsd.org/changeset/base/335154

Log:
  Fix da(4) locking when probing SMR drives.
  
  Probing host aware and host managed SMR drives got broken in revision
  330796.
  
  The added cam_periph_lock() calls were in areas in dadone() where
  the peripheral lock was already held.
  
  Since then, dadone() has been split into separate functions that are
  dedicated to each probe state.
  
  The result is that when probing a host aware drive, I ran into a recursive
  lock acquisition in dadone_probeatalogdir(). I would have run into the
  same problem in dadone_probeataiddir(), and in dadone_probeatasup() and
  dadone_probeatazone() in the error paths had the probe continued.
  
  The solution is to take out all of the extra cam_periph_lock() calls. I
  also added cam_periph_assert(periph, MA_OWNED) near the top of each of
  the dadone_* calls. These make it clear to anyone coming along in the
  the future that the lock is held in the probe done functions.
  
  Also add a locking assert in daprobedone(), to make it clear that it must
  be called with the periph lock held.
  
  Sponsored by: Spectra Logic
  Differential Revision:https://reviews.freebsd.org/D15764

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Thu Jun 14 17:06:19 2018(r335153)
+++ head/sys/cam/scsi/scsi_da.c Thu Jun 14 17:08:44 2018(r335154)
@@ -2428,6 +2428,8 @@ daprobedone(struct cam_periph *periph, union ccb *ccb)
 
softc = (struct da_softc *)periph->softc;
 
+   cam_periph_assert(periph, MA_OWNED);
+
dadeletemethodchoose(softc, DA_DELETE_NONE);
 
if (bootverbose && (softc->flags & DA_FLAG_ANNOUNCED) == 0) {
@@ -4505,6 +4507,8 @@ dadone_probewp(struct cam_periph *periph, union ccb *d
priority = done_ccb->ccb_h.pinfo.priority;
csio = _ccb->csio;
 
+   cam_periph_assert(periph, MA_OWNED);
+
if (softc->minimum_cmd_size > 6) {
mode_hdr10 = (struct scsi_mode_header_10 *)csio->data_ptr;
dev_spec = mode_hdr10->dev_spec;
@@ -4578,6 +4582,8 @@ dadone_proberc(struct cam_periph *periph, union ccb *d
rcaplong = (struct scsi_read_capacity_data_long *)
csio->data_ptr;
 
+   cam_periph_assert(periph, MA_OWNED);
+
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
struct disk_params *dp;
uint32_t block_size;
@@ -4835,6 +4841,8 @@ dadone_probelbp(struct cam_periph *periph, union ccb *
csio = _ccb->csio;
lbp = (struct scsi_vpd_logical_block_prov *)csio->data_ptr;
 
+   cam_periph_assert(periph, MA_OWNED);
+
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
/*
 * T10/1799-D Revision 31 states at least one of these
@@ -4891,6 +4899,8 @@ dadone_probeblklimits(struct cam_periph *periph, union
csio = _ccb->csio;
block_limits = (struct scsi_vpd_block_limits *)csio->data_ptr;
 
+   cam_periph_assert(periph, MA_OWNED);
+
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
uint32_t max_txfer_len = scsi_4btoul(
block_limits->max_txfer_len);
@@ -4983,6 +4993,8 @@ dadone_probebdc(struct cam_periph *periph, union ccb *
csio = _ccb->csio;
bdc = (struct scsi_vpd_block_device_characteristics *)csio->data_ptr;
 
+   cam_periph_assert(periph, MA_OWNED);
+
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
uint32_t valid_len;
 
@@ -5088,6 +5100,8 @@ dadone_probeata(struct cam_periph *periph, union ccb *
continue_probe = 0;
error = 0;
 
+   cam_periph_assert(periph, MA_OWNED);
+
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
uint16_t old_rate;
 
@@ -5223,7 +5237,7 @@ dadone_probeatalogdir(struct cam_periph *periph, union
priority = done_ccb->ccb_h.pinfo.priority;
csio = _ccb->csio;
 
-   cam_periph_lock(periph);
+   cam_periph_assert(periph, MA_OWNED);
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
error = 0;
softc->valid_logdir_len = 0;
@@ -5276,7 +5290,6 @@ dadone_probeatalogdir(struct cam_periph *periph, union
}
}
}
-   cam_periph_unlock(periph);
 
free(csio->data_ptr, M_SCSIDA);
 
@@ -5305,7 +5318,8 @@ dadone_probeataiddir(struct cam_periph *periph, union 
priority = done_ccb->ccb_h.pinfo.priority;
csio = _ccb->csio;
 
-   cam_periph_lock(periph);
+   cam_periph_assert(periph, MA_OWNED);
+
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
off_t entries_offset, max_entries;
error = 0;

svn commit: r333991 - stable/11/sys/dev/ocs_fc

2018-05-21 Thread Kenneth D. Merry
Author: ken
Date: Mon May 21 18:59:34 2018
New Revision: 333991
URL: https://svnweb.freebsd.org/changeset/base/333991

Log:
  MFC r333492:

r333492 | ken | 2018-05-11 08:50:26 -0600 (Fri, 11 May 2018) | 10 lines
  
Clear out the entire structure, not just the size of a pointer to it.
  
sys/dev/ocs/ocs_os.c:
In ocs_thread_create(), use sizeof(*thread) (instead of
sizeof(thread)) as the size argument to memset so that we clear
out the entire thread structure instead of just a few bytes of it.
  
Submitted by:   jtl
  

  
  Approved by:  re (marius, gjb)

Modified:
  stable/11/sys/dev/ocs_fc/ocs_os.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ocs_fc/ocs_os.c
==
--- stable/11/sys/dev/ocs_fc/ocs_os.c   Mon May 21 18:41:16 2018
(r333990)
+++ stable/11/sys/dev/ocs_fc/ocs_os.c   Mon May 21 18:59:34 2018
(r333991)
@@ -630,7 +630,7 @@ ocs_thread_create(ocs_os_handle_t os, ocs_thread_t *th
 {
int32_t rc = 0;
 
-   ocs_memset(thread, 0, sizeof(thread));
+   ocs_memset(thread, 0, sizeof(*thread));
 
thread->fctn = fctn;
thread->name = ocs_strdup(name);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r333492 - head/sys/dev/ocs_fc

2018-05-11 Thread Kenneth D. Merry
Author: ken
Date: Fri May 11 14:50:26 2018
New Revision: 333492
URL: https://svnweb.freebsd.org/changeset/base/333492

Log:
  Clear out the entire structure, not just the size of a pointer to it.
  
  sys/dev/ocs/ocs_os.c:
In ocs_thread_create(), use sizeof(*thread) (instead of
sizeof(thread)) as the size argument to memset so that we clear
out the entire thread structure instead of just a few bytes of it.
  
  Submitted by: jtl
  MFC after:3 days

Modified:
  head/sys/dev/ocs_fc/ocs_os.c

Modified: head/sys/dev/ocs_fc/ocs_os.c
==
--- head/sys/dev/ocs_fc/ocs_os.cFri May 11 14:43:21 2018
(r333491)
+++ head/sys/dev/ocs_fc/ocs_os.cFri May 11 14:50:26 2018
(r333492)
@@ -630,7 +630,7 @@ ocs_thread_create(ocs_os_handle_t os, ocs_thread_t *th
 {
int32_t rc = 0;
 
-   ocs_memset(thread, 0, sizeof(thread));
+   ocs_memset(thread, 0, sizeof(*thread));
 
thread->fctn = fctn;
thread->name = ocs_strdup(name);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332933 - stable/10/sys/cam/scsi

2018-04-24 Thread Kenneth D. Merry
Author: ken
Date: Tue Apr 24 13:52:39 2018
New Revision: 332933
URL: https://svnweb.freebsd.org/changeset/base/332933

Log:
  MFC r332458:

r332458 | ken | 2018-04-12 15:21:18 -0600 (Thu, 12 Apr 2018) | 34 lines
  
Handle Programmable Early Warning for control commands in sa(4).
  
When the tape position is inside the Early Warning area, the tape
drive will return a sense key of NO SENSE, and an ASC/ASCQ of
0x00,0x02, which means: End-of-partition/medium detected".  If
this was in response to a control command like WRITE FILEMARKS,
we correctly translate this as informational status and return
0 from saerror().
  
Programmable Early Warning should be handled the same way, but
we weren't handling it that way.  As a result, if a PEW status
(sense key of NO SENSE, ASC/ASCQ of 0x00,0x07, "Programmable early
warning detected") came back in response to a WRITE FILEMARKS,
we returned an error.
  
The impact of this was that if an application was writing to a
sa(4) device, and a PEW area was set (in the Device Configuration
Extension subpage -- mode page 0x10, subpage 1), and a filemark
needed to be written on close, we could wind up returning an error
to the user on close because of a "failure" to write the filemarks.
  
It actually isn't a failure, but rather just a status report from
the drive, and shouldn't be treated as a failure.
  
sys/cam/scsi/scsi_sa.c:
For control commands in saerror(), treat asc/ascq 0x00,0x07
the same as 0x00,{0-5} -- not an error.  Return 0, since
the command actually did succeed.
  
Reported by:Dr. Andreas Haakh 
Tested by:  Dr. Andreas Haakh 
Sponsored by:   Spectra Logic


Modified:
  stable/10/sys/cam/scsi/scsi_sa.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_sa.c
==
--- stable/10/sys/cam/scsi/scsi_sa.cTue Apr 24 13:44:19 2018
(r332932)
+++ stable/10/sys/cam/scsi/scsi_sa.cTue Apr 24 13:52:39 2018
(r332933)
@@ -3453,12 +3453,13 @@ saerror(union ccb *ccb, u_int32_t cflgs, u_int32_t sfl
break;
}
/*
-* If this was just EOM/EOP, Filemark, Setmark or ILI detected
-* on a non read/write command, we assume it's not an error
-* and propagate the residule and return.
+* If this was just EOM/EOP, Filemark, Setmark, ILI or
+* PEW detected on a non read/write command, we assume
+* it's not an error and propagate the residual and return.
 */
-   if ((aqvalid && asc == 0 && ascq > 0 && ascq <= 5) ||
-   (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) {
+   if ((aqvalid && asc == 0 && ((ascq > 0 && ascq <= 5)
+ || (ascq == 0x07)))
+|| (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) {
csio->resid = resid;
QFRLS(ccb);
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332647 - stable/11/sys/cam/scsi

2018-04-17 Thread Kenneth D. Merry
Author: ken
Date: Tue Apr 17 15:34:08 2018
New Revision: 332647
URL: https://svnweb.freebsd.org/changeset/base/332647

Log:
  MFC r332458:

r332458 | ken | 2018-04-12 15:21:18 -0600 (Thu, 12 Apr 2018) | 34 lines
  
Handle Programmable Early Warning for control commands in sa(4).
  
When the tape position is inside the Early Warning area, the tape
drive will return a sense key of NO SENSE, and an ASC/ASCQ of
0x00,0x02, which means: End-of-partition/medium detected".  If
this was in response to a control command like WRITE FILEMARKS,
we correctly translate this as informational status and return
0 from saerror().
  
Programmable Early Warning should be handled the same way, but
we weren't handling it that way.  As a result, if a PEW status
(sense key of NO SENSE, ASC/ASCQ of 0x00,0x07, "Programmable early
warning detected") came back in response to a WRITE FILEMARKS,
we returned an error.
  
The impact of this was that if an application was writing to a
sa(4) device, and a PEW area was set (in the Device Configuration
Extension subpage -- mode page 0x10, subpage 1), and a filemark
needed to be written on close, we could wind up returning an error
to the user on close because of a "failure" to write the filemarks.
  
It actually isn't a failure, but rather just a status report from
the drive, and shouldn't be treated as a failure.
  
sys/cam/scsi/scsi_sa.c:
For control commands in saerror(), treat asc/ascq 0x00,0x07
the same as 0x00,{0-5} -- not an error.  Return 0, since
the command actually did succeed.
  
Reported by:Dr. Andreas Haakh 
Tested by:  Dr. Andreas Haakh 
Sponsored by:   Spectra Logic


Modified:
  stable/11/sys/cam/scsi/scsi_sa.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_sa.c
==
--- stable/11/sys/cam/scsi/scsi_sa.cTue Apr 17 15:29:32 2018
(r332646)
+++ stable/11/sys/cam/scsi/scsi_sa.cTue Apr 17 15:34:08 2018
(r332647)
@@ -3454,12 +3454,13 @@ saerror(union ccb *ccb, u_int32_t cflgs, u_int32_t sfl
break;
}
/*
-* If this was just EOM/EOP, Filemark, Setmark or ILI detected
-* on a non read/write command, we assume it's not an error
-* and propagate the residule and return.
+* If this was just EOM/EOP, Filemark, Setmark, ILI or
+* PEW detected on a non read/write command, we assume
+* it's not an error and propagate the residual and return.
 */
-   if ((aqvalid && asc == 0 && ascq > 0 && ascq <= 5) ||
-   (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) {
+   if ((aqvalid && asc == 0 && ((ascq > 0 && ascq <= 5)
+ || (ascq == 0x07)))
+|| (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) {
csio->resid = resid;
QFRLS(ccb);
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332458 - head/sys/cam/scsi

2018-04-12 Thread Kenneth D. Merry
Author: ken
Date: Thu Apr 12 21:21:18 2018
New Revision: 332458
URL: https://svnweb.freebsd.org/changeset/base/332458

Log:
  Handle Programmable Early Warning for control commands in sa(4).
  
  When the tape position is inside the Early Warning area, the tape
  drive will return a sense key of NO SENSE, and an ASC/ASCQ of
  0x00,0x02, which means: End-of-partition/medium detected".  If
  this was in response to a control command like WRITE FILEMARKS,
  we correctly translate this as informational status and return
  0 from saerror().
  
  Programmable Early Warning should be handled the same way, but
  we weren't handling it that way.  As a result, if a PEW status
  (sense key of NO SENSE, ASC/ASCQ of 0x00,0x07, "Programmable early
  warning detected") came back in response to a WRITE FILEMARKS,
  we returned an error.
  
  The impact of this was that if an application was writing to a
  sa(4) device, and a PEW area was set (in the Device Configuration
  Extension subpage -- mode page 0x10, subpage 1), and a filemark
  needed to be written on close, we could wind up returning an error
  to the user on close because of a "failure" to write the filemarks.
  
  It actually isn't a failure, but rather just a status report from
  the drive, and shouldn't be treated as a failure.
  
  sys/cam/scsi/scsi_sa.c:
For control commands in saerror(), treat asc/ascq 0x00,0x07
the same as 0x00,{0-5} -- not an error.  Return 0, since
the command actually did succeed.
  
  Reported by:  Dr. Andreas Haakh 
  Tested by:Dr. Andreas Haakh 
  Sponsored by: Spectra Logic
  MFC after:3 days

Modified:
  head/sys/cam/scsi/scsi_sa.c

Modified: head/sys/cam/scsi/scsi_sa.c
==
--- head/sys/cam/scsi/scsi_sa.c Thu Apr 12 21:13:30 2018(r332457)
+++ head/sys/cam/scsi/scsi_sa.c Thu Apr 12 21:21:18 2018(r332458)
@@ -3453,12 +3453,13 @@ saerror(union ccb *ccb, u_int32_t cflgs, u_int32_t sfl
break;
}
/*
-* If this was just EOM/EOP, Filemark, Setmark or ILI detected
-* on a non read/write command, we assume it's not an error
-* and propagate the residule and return.
+* If this was just EOM/EOP, Filemark, Setmark, ILI or
+* PEW detected on a non read/write command, we assume
+* it's not an error and propagate the residual and return.
 */
-   if ((aqvalid && asc == 0 && ascq > 0 && ascq <= 5) ||
-   (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) {
+   if ((aqvalid && asc == 0 && ((ascq > 0 && ascq <= 5)
+ || (ascq == 0x07)))
+|| (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) {
csio->resid = resid;
QFRLS(ccb);
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r332386 - head/share/misc

2018-04-11 Thread Kenneth D. Merry
On Tue, Apr 10, 2018 at 14:27:26 -0500, Kyle Evans wrote:
> On Tue, Apr 10, 2018 at 2:22 PM, Rodney W. Grimes
>  wrote:
> > [ Charset UTF-8 unsupported, converting... ]
> >> Author: ram
> >> Date: Tue Apr 10 18:39:20 2018
> >> New Revision: 332386
> >> URL: https://svnweb.freebsd.org/changeset/base/332386
> >>
> >> Log:
> >>   Updated mentors information.
> >>
> >>   Approved by: ken, mav
> >>
> >> Modified:
> >>   head/share/misc/committers-src.dot
> >>
> >> Modified: head/share/misc/committers-src.dot
> >> ==
> >> --- head/share/misc/committers-src.dotTue Apr 10 18:05:02 2018 
> >>(r332385)
> >> +++ head/share/misc/committers-src.dotTue Apr 10 18:39:20 2018 
> >>(r332386)
> >> @@ -76,6 +76,7 @@ nate [label="Nate Willams\nn...@freebsd.org\n1993/06/1
> >>  njl [label="Nate Lawson\n...@freebsd.org\n2002/08/07\n2008/02/16"]
> >>  non [label="Noriaki Mitsnaga\n...@freebsd.org\n2000/06/19\n2007/03/06"]
> >>  onoe [label="Atsushi Onoe\no...@freebsd.org\n2000/07/21\n2008/11/10"]
> >> +ram [label="Ram Kishore Vegesna\n...@freebsd.org\n2018/04/04\n???/??/??"]
> >  ^
> > That should be removed, you only have a start date.
> > Oh and Welcome ram to the project!
> >
> 
> The entry is also smack dab in the middle of the alumni section,
> rather than the later 'active' section. =)

Oops.  My fault for not paying attention. :(

Pointy hat to:  ken

Ram, could you fix this and send me the diffs for approval before you
commit it?

Thanks,

Ken
-- 
Kenneth Merry
k...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332360 - svnadmin/conf

2018-04-10 Thread Kenneth D. Merry
Author: ken
Date: Tue Apr 10 13:16:50 2018
New Revision: 332360
URL: https://svnweb.freebsd.org/changeset/base/332360

Log:
  Add Ram Kishore Vegesna (ram) as a src committer.
  
  Ram works for Broadcom and will be maintaining the Broadcom / Emulex
  ocs_fc(4) fibre channel driver.
  
  Alexander Motin (mav) and I will be his mentors.
  
  Approved by:  core

Modified:
  svnadmin/conf/access
  svnadmin/conf/mentors

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessTue Apr 10 12:53:48 2018(r332359)
+++ svnadmin/conf/accessTue Apr 10 13:16:50 2018(r332360)
@@ -175,6 +175,7 @@ pkelsey
 pluknet
 pstef
 qingli
+ram
 ray
 rgrimes
 rlibby

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Tue Apr 10 12:53:48 2018(r332359)
+++ svnadmin/conf/mentors   Tue Apr 10 13:16:50 2018(r332360)
@@ -26,6 +26,7 @@ kadesai   ken Co-mentor: scottl, 
ambrisko
 mahrensmckusick
 mjoras rstone
 peterj jhb Co-mentor: grog
+ramken Co-mentor: mav
 rgrimesphk Co-mentor: bde
 sefmav
 slavashkib Co-mentor: hselasky
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332040 - in stable/11: share/man/man4 sys/amd64/conf sys/conf sys/dev/ocs_fc sys/modules sys/modules/ocs_fc

2018-04-04 Thread Kenneth D. Merry
Author: ken
Date: Wed Apr  4 18:06:52 2018
New Revision: 332040
URL: https://svnweb.freebsd.org/changeset/base/332040

Log:
  MFC r331766, r331768:
  

r331766 | ken | 2018-03-30 09:28:25 -0600 (Fri, 30 Mar 2018) | 25 lines
  
Bring in the Broadcom/Emulex Fibre Channel driver, ocs_fc(4).
  
The ocs_fc(4) driver supports the following hardware:
  
Emulex 16/8G FC GEN 5 HBAS
LPe15004 FC Host Bus Adapters
LPe160XX FC Host Bus Adapters
  
Emulex 32/16G FC GEN 6 HBAS
LPe3100X FC Host Bus Adapters
LPe3200X FC Host Bus Adapters
  
The driver supports target and initiator mode, and also supports FC-Tape.
  
Note that the driver only currently works on little endian platforms.  It
is only included in the module build for amd64 and i386, and in GENERIC
on amd64 only.
  
Submitted by:   Ram Kishore Vegesna 
Reviewed by:mav
Relnotes:   yes
Sponsored by:   Broadcom
Differential Revision:  https://reviews.freebsd.org/D11423
  

r331768 | cem | 2018-03-30 10:44:54 -0600 (Fri, 30 Mar 2018) | 9 lines
  
ocs_fc(4): Fix GCC build (-Wredundant-decls)
  
These objects are defined earlier in the same file; an extern declaration
after definition is redundant.
  
Broken in r331766 (introduction of ocs_fc(4)).
  
Sponsored by:   Dell EMC Isilon
  

  
  Differential Revision:https://reviews.freebsd.org/D11423
  Relnotes: yes

Added:
  stable/11/share/man/man4/ocs_fc.4
 - copied unchanged from r331766, head/share/man/man4/ocs_fc.4
  stable/11/sys/dev/ocs_fc/
 - copied from r331766, head/sys/dev/ocs_fc/
  stable/11/sys/modules/ocs_fc/
 - copied from r331766, head/sys/modules/ocs_fc/
Modified:
  stable/11/share/man/man4/Makefile
  stable/11/sys/amd64/conf/GENERIC
  stable/11/sys/conf/files
  stable/11/sys/dev/ocs_fc/sli4.c
  stable/11/sys/modules/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/Makefile
==
--- stable/11/share/man/man4/Makefile   Wed Apr  4 17:45:05 2018
(r332039)
+++ stable/11/share/man/man4/Makefile   Wed Apr  4 18:06:52 2018
(r332040)
@@ -402,6 +402,7 @@ MAN=aac.4 \
${_nvram2env.4} \
${_nxge.4} \
oce.4 \
+   ocs_fc.4\
ohci.4 \
orm.4 \
ow.4 \

Copied: stable/11/share/man/man4/ocs_fc.4 (from r331766, 
head/share/man/man4/ocs_fc.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/share/man/man4/ocs_fc.4   Wed Apr  4 18:06:52 2018
(r332040, copy of r331766, head/share/man/man4/ocs_fc.4)
@@ -0,0 +1,194 @@
+.\" Copyright (c) 2017 Broadcom. All rights reserved.
+.\" The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright notice,
+.\"this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright 
notice,
+.\"this list of conditions and the following disclaimer in the 
documentation
+.\"and/or other materials provided with the distribution.
+.\"
+.\" 3. Neither the name of the copyright holder nor the names of its 
contributors
+.\"may be used to endorse or promote products derived from this software
+.\"without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 30, 2018
+.Dt OCS_FC 4
+.Os
+.Sh NAME
+.Nm ocs_fc
+.Nd "Device driver for Emulex Fibre Channel Host Adapters"
+.Sh SYNOPSIS
+To compile this driver into the kernel, add this line to the

svn commit: r331766 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/ocs_fc sys/modules sys/modules/ocs_fc

2018-03-30 Thread Kenneth D. Merry
Author: ken
Date: Fri Mar 30 15:28:25 2018
New Revision: 331766
URL: https://svnweb.freebsd.org/changeset/base/331766

Log:
  Bring in the Broadcom/Emulex Fibre Channel driver, ocs_fc(4).
  
  The ocs_fc(4) driver supports the following hardware:
  
  Emulex 16/8G FC GEN 5 HBAS
LPe15004 FC Host Bus Adapters
LPe160XX FC Host Bus Adapters
  
  Emulex 32/16G FC GEN 6 HBAS
LPe3100X FC Host Bus Adapters
LPe3200X FC Host Bus Adapters
  
  The driver supports target and initiator mode, and also supports FC-Tape.
  
  Note that the driver only currently works on little endian platforms.  It
  is only included in the module build for amd64 and i386, and in GENERIC
  on amd64 only.
  
  Submitted by: Ram Kishore Vegesna 
  Reviewed by:  mav
  MFC after:5 days
  Relnotes: yes
  Sponsored by: Broadcom
  Differential Revision:https://reviews.freebsd.org/D11423

Added:
  head/share/man/man4/ocs_fc.4   (contents, props changed)
  head/sys/dev/ocs_fc/
  head/sys/dev/ocs_fc/ocs.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_cam.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_cam.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_common.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_ddump.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_ddump.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_device.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_device.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_domain.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_domain.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_drv_fc.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_els.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_els.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_fabric.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_fabric.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_fcp.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_hw.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_hw.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_hw_queues.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_hw_queues.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_io.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_io.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_ioctl.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_ioctl.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_list.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_mgmt.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_mgmt.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_node.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_node.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_os.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_os.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_pci.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_scsi.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_scsi.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_sm.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_sm.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_sport.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_sport.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_stats.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_unsol.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_unsol.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_utils.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_utils.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_vpd.h   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_xport.c   (contents, props changed)
  head/sys/dev/ocs_fc/ocs_xport.h   (contents, props changed)
  head/sys/dev/ocs_fc/sli4.c   (contents, props changed)
  head/sys/dev/ocs_fc/sli4.h   (contents, props changed)
  head/sys/dev/ocs_fc/version.h   (contents, props changed)
  head/sys/modules/ocs_fc/
  head/sys/modules/ocs_fc/Makefile   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/sys/amd64/conf/GENERIC
  head/sys/conf/files
  head/sys/modules/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileFri Mar 30 14:41:16 2018
(r331765)
+++ head/share/man/man4/MakefileFri Mar 30 15:28:25 2018
(r331766)
@@ -402,6 +402,7 @@ MAN=aac.4 \
${_nvram2env.4} \
${_nxge.4} \
oce.4 \
+   ocs_fc.4\
ohci.4 \
orm.4 \
ow.4 \

Added: head/share/man/man4/ocs_fc.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/ocs_fc.4Fri Mar 30 15:28:25 2018
(r331766)
@@ -0,0 +1,194 @@
+.\" Copyright (c) 2017 

svn commit: r331646 - in stable/11/sys/dev: mpr mps

2018-03-27 Thread Kenneth D. Merry
Author: ken
Date: Tue Mar 27 20:34:49 2018
New Revision: 331646
URL: https://svnweb.freebsd.org/changeset/base/331646

Log:
  MFC r331422:
  

r331422 | ken | 2018-03-23 07:52:26 -0600 (Fri, 23 Mar 2018) | 42 lines
  
Disable T10 Protection Information / EEDP handling for type 2 protection.
  
The mps(4) and mpr(4) drivers and hardware handle T10 Protection
Information, which is a system of checksums and guard blocks to protect
data while it is being transferred and while it is on disk.  It is also
known as T10 DIF.  For more details, see section 4.22 of the SBC-4 spec.
  
Supporting Type 2 protection requires using 32 byte CDBs, and filling in
the fields in those CDBs.  We don't yet support that in the da(4) driver.
  
Type 1 and Type 3 protection don't require that, and can be handled by
the mps(4)/mpr(4) driver's code and firmware without any additional
input from the da(4) driver.
  
If a drive has Type 2 protection enabled (you frequently see this with
SAS drives shipped from Dell), don't set the various EEDP fields in the
mps(4)/mpr(4) driver command fields.  Otherwise, you wind up with errors
like this that would otherwise make no sense:
  
(da9:mpr0:0:18:0): READ(10). CDB: 28 00 00 00 00 00 00 02 00 00
(da9:mpr0:0:18:0): CAM status: SCSI Status Error
(da9:mpr0:0:18:0): SCSI status: Check Condition
(da9:mpr0:0:18:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command 
operation code)
(da9:mpr0:0:18:0):
(da9:mpr0:0:18:0): Field Replaceable Unit: 0
(da9:mpr0:0:18:0): Command Specific Info: 0
(da9:mpr0:0:18:0):
(da9:mpr0:0:18:0): Descriptor 0x80: f8 21
(da9:mpr0:0:18:0): Descriptor 0x81: 00 00 00 00 00 00
(da9:mpr0:0:18:0): Error 22, Unretryable error
  
In other words, what kind of strange SAS hard drive doesn't support a
standard 10 byte SCSI READ command?  In this case, one that has Type 2
protection enabled.
  
We can revisit this when we put Type 2 protection support in the da(4)
driver, but for now this will help people who put Type 2 formatted drives
in a system and wonder what in the world is going on.
  
Sponsored by:   Spectra Logic
  


Modified:
  stable/11/sys/dev/mpr/mpr_sas.c
  stable/11/sys/dev/mps/mps_sas.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mpr/mpr_sas.c
==
--- stable/11/sys/dev/mpr/mpr_sas.c Tue Mar 27 20:14:22 2018
(r331645)
+++ stable/11/sys/dev/mpr/mpr_sas.c Tue Mar 27 20:34:49 2018
(r331646)
@@ -2112,8 +2112,8 @@ mprsas_action_scsiio(struct mprsas_softc *sassc, union
CDB.EEDP32.PrimaryReferenceTag);
req->CDB.EEDP32.PrimaryApplicationTagMask =
0x;
-   req->CDB.CDB32[1] = (req->CDB.CDB32[1] & 0x1F) |
-   0x20;
+   req->CDB.CDB32[1] =
+   (req->CDB.CDB32[1] & 0x1F) | 0x20;
} else {
eedp_flags |=
MPI2_SCSIIO_EEDPFLAGS_INC_PRI_APPTAG;
@@ -3614,8 +3614,19 @@ mprsas_async(void *callback_arg, uint32_t code, struct
 
if ((mprsas_get_ccbstatus((union ccb *)) == CAM_REQ_CMP)
&& (rcap_buf.prot & SRC16_PROT_EN)) {
-   lun->eedp_formatted = TRUE;
-   lun->eedp_block_size = scsi_4btoul(rcap_buf.length);
+   switch (rcap_buf.prot & SRC16_P_TYPE) {
+   case SRC16_PTYPE_1:
+   case SRC16_PTYPE_3:
+   lun->eedp_formatted = TRUE;
+   lun->eedp_block_size =
+   scsi_4btoul(rcap_buf.length);
+   break;
+   case SRC16_PTYPE_2:
+   default:
+   lun->eedp_formatted = FALSE;
+   lun->eedp_block_size = 0;
+   break;
+   }
} else {
lun->eedp_formatted = FALSE;
lun->eedp_block_size = 0;

Modified: stable/11/sys/dev/mps/mps_sas.c
==
--- stable/11/sys/dev/mps/mps_sas.c Tue Mar 27 20:14:22 2018
(r331645)
+++ stable/11/sys/dev/mps/mps_sas.c Tue Mar 27 20:34:49 2018
(r331646)
@@ -3338,8 +3338,19 @@ mpssas_async(void *callback_arg, uint32_t code, struct
 
if ((mpssas_get_ccbstatus((union ccb *)) == 

svn commit: r331422 - in head/sys/dev: mpr mps

2018-03-23 Thread Kenneth D. Merry
Author: ken
Date: Fri Mar 23 13:52:26 2018
New Revision: 331422
URL: https://svnweb.freebsd.org/changeset/base/331422

Log:
  Disable T10 Protection Information / EEDP handling for type 2 protection.
  
  The mps(4) and mpr(4) drivers and hardware handle T10 Protection
  Information, which is a system of checksums and guard blocks to protect
  data while it is being transferred and while it is on disk.  It is also
  known as T10 DIF.  For more details, see section 4.22 of the SBC-4 spec.
  
  Supporting Type 2 protection requires using 32 byte CDBs, and filling in
  the fields in those CDBs.  We don't yet support that in the da(4) driver.
  
  Type 1 and Type 3 protection don't require that, and can be handled by
  the mps(4)/mpr(4) driver's code and firmware without any additional
  input from the da(4) driver.
  
  If a drive has Type 2 protection enabled (you frequently see this with
  SAS drives shipped from Dell), don't set the various EEDP fields in the
  mps(4)/mpr(4) driver command fields.  Otherwise, you wind up with errors
  like this that would otherwise make no sense:
  
  (da9:mpr0:0:18:0): READ(10). CDB: 28 00 00 00 00 00 00 02 00 00
  (da9:mpr0:0:18:0): CAM status: SCSI Status Error
  (da9:mpr0:0:18:0): SCSI status: Check Condition
  (da9:mpr0:0:18:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command 
operation code)
  (da9:mpr0:0:18:0):
  (da9:mpr0:0:18:0): Field Replaceable Unit: 0
  (da9:mpr0:0:18:0): Command Specific Info: 0
  (da9:mpr0:0:18:0):
  (da9:mpr0:0:18:0): Descriptor 0x80: f8 21
  (da9:mpr0:0:18:0): Descriptor 0x81: 00 00 00 00 00 00
  (da9:mpr0:0:18:0): Error 22, Unretryable error
  
  In other words, what kind of strange SAS hard drive doesn't support a
  standard 10 byte SCSI READ command?  In this case, one that has Type 2
  protection enabled.
  
  We can revisit this when we put Type 2 protection support in the da(4)
  driver, but for now this will help people who put Type 2 formatted drives
  in a system and wonder what in the world is going on.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mps/mps_sas.c

Modified: head/sys/dev/mpr/mpr_sas.c
==
--- head/sys/dev/mpr/mpr_sas.c  Fri Mar 23 11:08:59 2018(r331421)
+++ head/sys/dev/mpr/mpr_sas.c  Fri Mar 23 13:52:26 2018(r331422)
@@ -2130,8 +2130,8 @@ mprsas_action_scsiio(struct mprsas_softc *sassc, union
CDB.EEDP32.PrimaryReferenceTag);
req->CDB.EEDP32.PrimaryApplicationTagMask =
0x;
-   req->CDB.CDB32[1] = (req->CDB.CDB32[1] & 0x1F) |
-   0x20;
+   req->CDB.CDB32[1] =
+   (req->CDB.CDB32[1] & 0x1F) | 0x20;
} else {
eedp_flags |=
MPI2_SCSIIO_EEDPFLAGS_INC_PRI_APPTAG;
@@ -3502,8 +3502,19 @@ mprsas_async(void *callback_arg, uint32_t code, struct
 
if ((mprsas_get_ccbstatus((union ccb *)) == CAM_REQ_CMP)
&& (rcap_buf.prot & SRC16_PROT_EN)) {
-   lun->eedp_formatted = TRUE;
-   lun->eedp_block_size = scsi_4btoul(rcap_buf.length);
+   switch (rcap_buf.prot & SRC16_P_TYPE) {
+   case SRC16_PTYPE_1:
+   case SRC16_PTYPE_3:
+   lun->eedp_formatted = TRUE;
+   lun->eedp_block_size =
+   scsi_4btoul(rcap_buf.length);
+   break;
+   case SRC16_PTYPE_2:
+   default:
+   lun->eedp_formatted = FALSE;
+   lun->eedp_block_size = 0;
+   break;
+   }
} else {
lun->eedp_formatted = FALSE;
lun->eedp_block_size = 0;

Modified: head/sys/dev/mps/mps_sas.c
==
--- head/sys/dev/mps/mps_sas.c  Fri Mar 23 11:08:59 2018(r331421)
+++ head/sys/dev/mps/mps_sas.c  Fri Mar 23 13:52:26 2018(r331422)
@@ -3231,8 +3231,19 @@ mpssas_async(void *callback_arg, uint32_t code, struct
 
if ((mpssas_get_ccbstatus((union ccb *)) == CAM_REQ_CMP)
 && (rcap_buf.prot & SRC16_PROT_EN)) {
-   lun->eedp_formatted = TRUE;
-   lun->eedp_block_size = scsi_4btoul(rcap_buf.length);
+   switch (rcap_buf.prot & SRC16_P_TYPE) {
+   case SRC16_PTYPE_1:
+   case SRC16_PTYPE_3:
+   lun->eedp_formatted = TRUE;
+   

svn commit: r331223 - head/sys/cam/scsi

2018-03-19 Thread Kenneth D. Merry
Author: ken
Date: Mon Mar 19 20:19:00 2018
New Revision: 331223
URL: https://svnweb.freebsd.org/changeset/base/331223

Log:
  cam_periph_acquire() now returns an errno.
  
  The ch(4) driver was missed in change 328918, which changed
  cam_periph_acquire() to return an errno instead of cam_status.
  
  As a result, ch(4) failed to attach.
  
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/scsi/scsi_ch.c

Modified: head/sys/cam/scsi/scsi_ch.c
==
--- head/sys/cam/scsi/scsi_ch.c Mon Mar 19 19:32:05 2018(r331222)
+++ head/sys/cam/scsi/scsi_ch.c Mon Mar 19 20:19:00 2018(r331223)
@@ -419,7 +419,7 @@ chregister(struct cam_periph *periph, void *arg)
 * instance for it.  We'll release this reference once the devfs
 * instance has been freed.
 */
-   if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+   if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
  "registration!\n", __func__);
cam_periph_lock(periph);
@@ -467,7 +467,7 @@ chopen(struct cdev *dev, int flags, int fmt, struct th
int error;
 
periph = (struct cam_periph *)dev->si_drv1;
-   if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+   if (cam_periph_acquire(periph) != 0)
return (ENXIO);
 
softc = (struct ch_softc *)periph->softc;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r328936 - in head/sys/dev: mpr mps

2018-02-06 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb  6 15:58:22 2018
New Revision: 328936
URL: https://svnweb.freebsd.org/changeset/base/328936

Log:
  Diagnostic buffer fixes for the mps(4) and mpr(4) drivers.
  
  In mp{r,s}_diag_register(), which is used to register diagnostic
  buffers with the mp{r,s}(4) firmware, we allocate DMAable memory.
  
  There were several issues here:
   o No checking of the bus_dmamap_load() return value.  If the load
 failed or got deferred, mp{r,s}_diag_register() continued on as if
 nothing had happened.  We now check the return value and bail
 out if it fails.
  
   o No waiting for a deferred load callback.  bus_dmamap_load()
 calls a supplied callback when the mapping is done.  This is
 generally done immediately, but it can be deferred.
 mp{r,s}_diag_register() did not check to see whether the callback
 was already done before proceeding on.  We now sleep until the
 callback is done if it is deferred.
  
   o No call to bus_dmamap_sync(... BUS_DMASYNC_PREREAD) after the
 memory is allocated and loaded.  This is necessary on some
 platforms to synchronize host memory that is going to be updated
 by a device.
  
  Both drivers would also panic if the firmware was reinitialized while
  a diagnostic buffer operation was in progress.  This fixes that problem
  as well.  (The driver will reinitialize the firmware in various
  circumstances, but the problem I ran into was that the firmware would
  generate an IOC Fault due to a PCIe error.)
  
  mp{r,s}var.h:
Add a new structure, struct mpr_busdma_context, that is
used for deferred busdma load callbacks.
  
Add a prototype for mp{r,s}_memaddr_wait_cb().
  mp{r,s}.c:
Add a new busdma callback function, mp{r,s}_memaddr_wait_cb().
This provides synchronization for callers that want to
wait on a deferred bus_dmamap_load() callback.
  
  mp{r,s}_user.c:
In bus_dmamap_register(), add a call to bus_dmamap_sync()
with the BUS_DMASYNC_PREREAD flag set after an allocation
is loaded.
  
Also, check the return value of bus_dmamap_load().  If it
fails, bail out.  If it is EINPROGRESS, wait for the
callback to happen.  We use an interruptible sleep (msleep
with PCATCH) and let the callback clean things up if we get
interrupted.
  
In mpr_diag_read_buffer() and mps_diag_read_buffer(), call
bus_dmamap_sync(..., BUS_DMASYNC_POSTREAD) before copying
the data out to make sure the data is in stable storage.
  
In mp{r,s}_post_fw_diag_buffer() and
mp{r,s}_release_fw_diag_buffer(), check the reply to see
whether it is NULL.  It can be NULL (and the command non-NULL)
if the controller gets reinitialized while we're waiting for
the command to complete but the driver structures aren't
reallocated.  The driver structures generally won't be
reallocated unless there is a firmware upgrade that changes
one of the IOCFacts.
  
When freeing diagnostic buffers in mp{r,s}_diag_register()
and mp{r,s}_diag_unregister(), zero/NULL out the buffer after
freeing it.  This will prevent a duplicate free in some
situations.
  
  Sponsored by: Spectra Logic
  Reviewed by:  mav, scottl
  MFC after:1 week
  Differential Revision:D13453

Modified:
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mpr/mpr_user.c
  head/sys/dev/mpr/mprvar.h
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_user.c
  head/sys/dev/mps/mpsvar.h

Modified: head/sys/dev/mpr/mpr.c
==
--- head/sys/dev/mpr/mpr.c  Tue Feb  6 15:41:45 2018(r328935)
+++ head/sys/dev/mpr/mpr.c  Tue Feb  6 15:58:22 2018(r328936)
@@ -1183,6 +1183,42 @@ mpr_memaddr_cb(void *arg, bus_dma_segment_t *segs, int
*addr = segs[0].ds_addr;
 }
 
+void
+mpr_memaddr_wait_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
+{
+   struct mpr_busdma_context *ctx;
+   int need_unload, need_free;
+
+   ctx = (struct mpr_busdma_context *)arg;
+   need_unload = 0;
+   need_free = 0;
+
+   mpr_lock(ctx->softc);
+   ctx->error = error;
+   ctx->completed = 1;
+   if ((error == 0) && (ctx->abandoned == 0)) {
+   *ctx->addr = segs[0].ds_addr;
+   } else {
+   if (nsegs != 0)
+   need_unload = 1;
+   if (ctx->abandoned != 0)
+   need_free = 1;
+   }
+   if (need_free == 0)
+   wakeup(ctx);
+
+   mpr_unlock(ctx->softc);
+
+   if (need_unload != 0) {
+   bus_dmamap_unload(ctx->buffer_dmat,
+ ctx->buffer_dmamap);
+   *ctx->addr = 0;
+   }
+
+   if (need_free != 0)
+   free(ctx, M_MPR);
+}
+
 static int
 mpr_alloc_queues(struct mpr_softc *sc)
 {

Modified: 

svn commit: r325496 - in stable/10: lib/libmt usr.bin/mt

2017-11-06 Thread Kenneth D. Merry
Author: ken
Date: Mon Nov  6 20:08:02 2017
New Revision: 325496
URL: https://svnweb.freebsd.org/changeset/base/325496

Log:
  MFC r325371

r325371 | ken | 2017-11-03 15:04:22 -0600 (Fri, 03 Nov 2017) | 19 lines
  
Add the LTO-8 Type M density code (0x5d, LTO-8M) to libmt and the
mt(1) man page.
  
LTO-8 Type M (also known as M8) is a pristine LTO-7 cartridge
formatted in a LTO-8 drive in a new, higher density format.  It
has a separate density code, and is only readable in an LTO-8
drive.
  
lib/libmt/mtlib.c:
Add the LTO-8 Type M density code to the density table
in libmt.
  
usr.bin/mt/mt.1:
Add the LTO-8 Type M density code to the density
table in the mt(1) man page.
  
Sponsored by:   Spectra Logic
  


Modified:
  stable/10/lib/libmt/mtlib.c
  stable/10/usr.bin/mt/mt.1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libmt/mtlib.c
==
--- stable/10/lib/libmt/mtlib.c Mon Nov  6 20:08:00 2017(r325495)
+++ stable/10/lib/libmt/mtlib.c Mon Nov  6 20:08:02 2017(r325496)
@@ -645,6 +645,7 @@ static struct densities {
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
+   { 0x5D, 19107,  485318, "LTO-M8" },
{ 0x5E, 20669,  524993, "LTO-8" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },

Modified: stable/10/usr.bin/mt/mt.1
==
--- stable/10/usr.bin/mt/mt.1   Mon Nov  6 20:08:00 2017(r325495)
+++ stable/10/usr.bin/mt/mt.1   Mon Nov  6 20:08:02 2017(r325496)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd August 11, 2017
+.Dd November 3, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -522,6 +522,7 @@ Value  WidthTracksDensity Code Typ
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
+0x5D   12.7  (0.5) 5376  19,107 (485,318)   C   LTO-M8   14
 0x5E   12.7  (0.5) 6656  20,669 (524,993)   C   LTO-8
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
@@ -565,6 +566,10 @@ NOTES
 12. This is Exabyte 8500 uncompressed format.  The compressed format
 density code is 0x8c.
 13. This density code (0x48) was also used for DAT-160.
+14. Officially known as LTO-8 Type M, abbreviated M8.  This is a pristine
+LTO-7 cartridge initialized with a higher density format by an LTO-8
+drive.  It cannot be read by an LTO-7 drive.  Uncompressed capacity
+is 9TB, compared to 6TB for LTO-7 and 12TB for LTO-8.
 .Ed
 .Bd -literal -offset 2n
 NOTE ON QIC STREAMERS
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r325495 - in stable/11: lib/libmt usr.bin/mt

2017-11-06 Thread Kenneth D. Merry
Author: ken
Date: Mon Nov  6 20:08:00 2017
New Revision: 325495
URL: https://svnweb.freebsd.org/changeset/base/325495

Log:
  MFC r325371

r325371 | ken | 2017-11-03 15:04:22 -0600 (Fri, 03 Nov 2017) | 19 lines
  
Add the LTO-8 Type M density code (0x5d, LTO-8M) to libmt and the
mt(1) man page.
  
LTO-8 Type M (also known as M8) is a pristine LTO-7 cartridge
formatted in a LTO-8 drive in a new, higher density format.  It
has a separate density code, and is only readable in an LTO-8
drive.
  
lib/libmt/mtlib.c:
Add the LTO-8 Type M density code to the density table
in libmt.
  
usr.bin/mt/mt.1:
Add the LTO-8 Type M density code to the density
table in the mt(1) man page.
  
Sponsored by:   Spectra Logic
  


Modified:
  stable/11/lib/libmt/mtlib.c
  stable/11/usr.bin/mt/mt.1
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libmt/mtlib.c
==
--- stable/11/lib/libmt/mtlib.c Mon Nov  6 19:54:25 2017(r325494)
+++ stable/11/lib/libmt/mtlib.c Mon Nov  6 20:08:00 2017(r325495)
@@ -645,6 +645,7 @@ static struct densities {
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
+   { 0x5D, 19107,  485318, "LTO-M8" },
{ 0x5E, 20669,  524993, "LTO-8" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },

Modified: stable/11/usr.bin/mt/mt.1
==
--- stable/11/usr.bin/mt/mt.1   Mon Nov  6 19:54:25 2017(r325494)
+++ stable/11/usr.bin/mt/mt.1   Mon Nov  6 20:08:00 2017(r325495)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd August 11, 2017
+.Dd November 3, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -522,6 +522,7 @@ Value  WidthTracksDensity Code Typ
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
+0x5D   12.7  (0.5) 5376  19,107 (485,318)   C   LTO-M8   14
 0x5E   12.7  (0.5) 6656  20,669 (524,993)   C   LTO-8
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
@@ -565,6 +566,10 @@ NOTES
 12. This is Exabyte 8500 uncompressed format.  The compressed format
 density code is 0x8c.
 13. This density code (0x48) was also used for DAT-160.
+14. Officially known as LTO-8 Type M, abbreviated M8.  This is a pristine
+LTO-7 cartridge initialized with a higher density format by an LTO-8
+drive.  It cannot be read by an LTO-7 drive.  Uncompressed capacity
+is 9TB, compared to 6TB for LTO-7 and 12TB for LTO-8.
 .Ed
 .Bd -literal -offset 2n
 NOTE ON QIC STREAMERS
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r325371 - in head: lib/libmt usr.bin/mt

2017-11-03 Thread Kenneth D. Merry
Author: ken
Date: Fri Nov  3 21:04:22 2017
New Revision: 325371
URL: https://svnweb.freebsd.org/changeset/base/325371

Log:
  Add the LTO-8 Type M density code (0x5d, LTO-8M) to libmt and the
  mt(1) man page.
  
  LTO-8 Type M (also known as M8) is a pristine LTO-7 cartridge
  formatted in a LTO-8 drive in a new, higher density format.  It
  has a separate density code, and is only readable in an LTO-8
  drive.
  
  lib/libmt/mtlib.c:
Add the LTO-8 Type M density code to the density table
in libmt.
  
  usr.bin/mt/mt.1:
Add the LTO-8 Type M density code to the density
table in the mt(1) man page.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/lib/libmt/mtlib.c
  head/usr.bin/mt/mt.1

Modified: head/lib/libmt/mtlib.c
==
--- head/lib/libmt/mtlib.c  Fri Nov  3 20:46:12 2017(r325370)
+++ head/lib/libmt/mtlib.c  Fri Nov  3 21:04:22 2017(r325371)
@@ -645,6 +645,7 @@ static struct densities {
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
+   { 0x5D, 19107,  485318, "LTO-M8" },
{ 0x5E, 20669,  524993, "LTO-8" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },

Modified: head/usr.bin/mt/mt.1
==
--- head/usr.bin/mt/mt.1Fri Nov  3 20:46:12 2017(r325370)
+++ head/usr.bin/mt/mt.1Fri Nov  3 21:04:22 2017(r325371)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd August 11, 2017
+.Dd November 3, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -522,6 +522,7 @@ Value  WidthTracksDensity Code Typ
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
+0x5D   12.7  (0.5) 5376  19,107 (485,318)   C   LTO-M8   14
 0x5E   12.7  (0.5) 6656  20,669 (524,993)   C   LTO-8
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
@@ -565,6 +566,10 @@ NOTES
 12. This is Exabyte 8500 uncompressed format.  The compressed format
 density code is 0x8c.
 13. This density code (0x48) was also used for DAT-160.
+14. Officially known as LTO-8 Type M, abbreviated M8.  This is a pristine
+LTO-7 cartridge initialized with a higher density format by an LTO-8
+drive.  It cannot be read by an LTO-7 drive.  Uncompressed capacity
+is 9TB, compared to 6TB for LTO-7 and 12TB for LTO-8.
 .Ed
 .Bd -literal -offset 2n
 NOTE ON QIC STREAMERS
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322819 - head/usr.sbin/camdd

2017-08-23 Thread Kenneth D. Merry
Author: ken
Date: Wed Aug 23 17:52:49 2017
New Revision: 322819
URL: https://svnweb.freebsd.org/changeset/base/322819

Log:
  Fix a resource leak in an error case in camdd_buf_sg_create().
  
  Submitted by: Coverity
  CID:  1341622
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/usr.sbin/camdd/camdd.c

Modified: head/usr.sbin/camdd/camdd.c
==
--- head/usr.sbin/camdd/camdd.c Wed Aug 23 17:47:57 2017(r322818)
+++ head/usr.sbin/camdd/camdd.c Wed Aug 23 17:52:49 2017(r322819)
@@ -824,6 +824,7 @@ camdd_buf_sg_create(struct camdd_buf *buf, int iovec, 
struct camdd_buf_data *data;
uint8_t *extra_buf = NULL;
size_t extra_buf_len = 0;
+   int extra_buf_attached = 0;
int i, retval = 0;
 
data = >buf_type_spec.data;
@@ -913,6 +914,7 @@ camdd_buf_sg_create(struct camdd_buf *buf, int iovec, 
data->iovec[i].iov_base = extra_buf;
data->iovec[i].iov_len = extra_buf_len;
}
+   extra_buf_attached = 1;
i++;
}
if ((tmp_buf != NULL) || (i != data->sg_count)) {
@@ -926,6 +928,14 @@ bailout:
if (retval == 0) {
*num_sectors_used = (data->fill_len + extra_buf_len) /
sector_size;
+   } else if (extra_buf_attached == 0) {
+   /*
+* If extra_buf isn't attached yet, we need to free it
+* to avoid leaking.
+*/
+   free(extra_buf);
+   data->extra_buf = 0;
+   data->sg_count--;
}
return (retval);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322790 - stable/10/usr.bin/mt

2017-08-22 Thread Kenneth D. Merry
Author: ken
Date: Tue Aug 22 14:40:56 2017
New Revision: 322790
URL: https://svnweb.freebsd.org/changeset/base/322790

Log:
  MFC r322410:

r322410 | ken | 2017-08-11 12:43:52 -0600 (Fri, 11 Aug 2017) | 16 lines
  
Add historical notes on QIC tape drives and fix a couple of issues in mt(1).
  
 o Density code 0x5 is also known as QIC-11, and should have a footnote
   reference.
 o Add notes on QIC tape drives from the bug report.  These may help anyone
   trying to use a QIC drive.
 o Take out a "more more" instance found by igor.
 o Bump the man page date.
  
The PR is 14 years old, so it's past time to retire it.
  
PR: doc/53596
Submitted by:   t...@toybox.placo.com
Reviewed by:bcr
Sponsored by:   Spectra Logic
  

  
  Approved by:  re (gjb)

Modified:
  stable/10/usr.bin/mt/mt.1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/mt/mt.1
==
--- stable/10/usr.bin/mt/mt.1   Tue Aug 22 14:06:43 2017(r322789)
+++ stable/10/usr.bin/mt/mt.1   Tue Aug 22 14:40:56 2017(r322790)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd August 3, 2017
+.Dd August 11, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -333,7 +333,7 @@ The default protection method used is Reed-Solomon CRC
 1), as specified in ECMA-319.
 The default protection information length used with Reed-Solomon CRC is
 4 bytes.
-To enable all settings except one more more settings, specify the
+To enable all settings except one more setting, specify the
 .Fl e
 argument and then explicitly disable settings that you do not wish to
 enable.
@@ -463,7 +463,7 @@ Value  WidthTracksDensity Code Typ
 0x01   12.7  (0.5)9 32 (800)  NRZI  R   X3.22-1983   2
 0x02   12.7  (0.5)9 63   (1,600)  PER   X3.39-1986   2
 0x03   12.7  (0.5)9246   (6,250)  GCR   R   X3.54-1986   2
-0x056.3  (0.25)  4/9   315   (8,000)  GCR   C   X3.136-1986  1
+0x056.3  (0.25)  4/9   315   (8,000)  GCR   C   X3.136-1986  1,3
 0x06   12.7  (0.5)9126   (3,200)  PER   X3.157-1987  2
 0x076.3  (0.25)   4252   (6,400)  IMFM  C   X3.116-1986  1
 0x083.81 (0.15)   4315   (8,000)  GCR   CS  X3.158-1987  1
@@ -566,6 +566,60 @@ NOTES
 density code is 0x8c.
 13. This density code (0x48) was also used for DAT-160.
 .Ed
+.Bd -literal -offset 2n
+NOTE ON QIC STREAMERS
+
+The following is a table of Data Cartridge types as used in the 1/4 inch
+tape drives such as the Archive Viper 150, Wangtek 5525ES, and Tandberg
+TDC4220 tape drives:
+
+Value Reference FormatCartridge Type  Capacity   Tracks  Length
+- - ----     --  --
+
+0x05QIC-11DC300   15MB   4300ft
+0x05QIC-11DC300XL/P   20MB   4450ft
+0x05QIC-11DC600   27MB   4600ft
+0x05  X3.136-1986   QIC-24DC615A  15MB   9150ft
+0x05  X3.136-1986   QIC-24DC300XL/P   45MB   9450ft
+0x05  X3.136-1986   QIC-24DC600A  60MB   9600ft
+0x0F  QIC-120   QIC-120   DC600A/DC6150   120MB  15   620ft
+0x10  QIC-150   QIC-150   DC600XTD/DC6150 150MB  18   620ft
+0x10  QIC-150   QIC-150   DC6250  250MB  18 1,020ft
+0x11  QIC-320   QIC-525   DC6320  320MB  26   620ft
+0x11  QIC-320   QIC-525   DC6525  525MB  26 1,020ft
+0x1E  QIC-1000C QIC-1000  DC9100/DL9135   1.0GB  30   760ft
+0x1E  QIC-1000C QIC-1000  DC9150  1.2GB  30   950ft
+0x22  QIC-2GB(C)QIC-2GB   DC9200  2.0GB  42   950ft
+0x22  QIC-2GB(C)QIC-2GB   DC9250  2.5GB  42 1,200ft
+.Ed
+.Pp
+Notes:
+.Pp
+QIC-24, QIC-120, QIC-150 use fixed blocksize of 512 bytes, QIC-525, QIC-1000
+and QIC-2GB can use blocksize of 1,024 bytes.
+DDS (DAT) drives generally use variable blocks.
+.Pp
+QIC-02 and QIC-36 are interface standards for tape drives.
+The QIC-02 and QIC-36 streamers such as the Wangtek 5250EQ are otherwise
+identical to their SCSI versions (i.e.: Wangtek 5250ES).
+.Pp
+It seems that the 150MB and larger streamers cannot write QIC-24 9 track
+formats, only read them.
+.Pp
+DC600A cartridges marked "10,000ftpi" can only be used as QIC-11, QIC-24,
+and QIC-120 format.
+DC600A cartridges marked 12,500ftpi can be used as both QIC-120 and QIC-150
+format.
+.Pp
+Some manufacturers do not use "DC" on their cartridges.
+Verbatim uses DL, Maxell uses MC, Sony uses QD, Quill uses DQ.
+.Pp
+3M/Imation & Fuji use DC.
+Thus a DL6250, MC-6250, 

svn commit: r322788 - stable/11/usr.bin/mt

2017-08-22 Thread Kenneth D. Merry
Author: ken
Date: Tue Aug 22 13:59:50 2017
New Revision: 322788
URL: https://svnweb.freebsd.org/changeset/base/322788

Log:
  MFC r322410:

r322410 | ken | 2017-08-11 12:43:52 -0600 (Fri, 11 Aug 2017) | 16 lines
  
Add historical notes on QIC tape drives and fix a couple of issues in mt(1).
  
 o Density code 0x5 is also known as QIC-11, and should have a footnote
   reference.
 o Add notes on QIC tape drives from the bug report.  These may help anyone
   trying to use a QIC drive.
 o Take out a "more more" instance found by igor.
 o Bump the man page date.
  
The PR is 14 years old, so it's past time to retire it.
  
PR: doc/53596
Submitted by:   t...@toybox.placo.com
Reviewed by:bcr
Sponsored by:   Spectra Logic
  


Modified:
  stable/11/usr.bin/mt/mt.1
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/mt/mt.1
==
--- stable/11/usr.bin/mt/mt.1   Tue Aug 22 13:53:53 2017(r322787)
+++ stable/11/usr.bin/mt/mt.1   Tue Aug 22 13:59:50 2017(r322788)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd August 3, 2017
+.Dd August 11, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -333,7 +333,7 @@ The default protection method used is Reed-Solomon CRC
 1), as specified in ECMA-319.
 The default protection information length used with Reed-Solomon CRC is
 4 bytes.
-To enable all settings except one more more settings, specify the
+To enable all settings except one more setting, specify the
 .Fl e
 argument and then explicitly disable settings that you do not wish to
 enable.
@@ -463,7 +463,7 @@ Value  WidthTracksDensity Code Typ
 0x01   12.7  (0.5)9 32 (800)  NRZI  R   X3.22-1983   2
 0x02   12.7  (0.5)9 63   (1,600)  PER   X3.39-1986   2
 0x03   12.7  (0.5)9246   (6,250)  GCR   R   X3.54-1986   2
-0x056.3  (0.25)  4/9   315   (8,000)  GCR   C   X3.136-1986  1
+0x056.3  (0.25)  4/9   315   (8,000)  GCR   C   X3.136-1986  1,3
 0x06   12.7  (0.5)9126   (3,200)  PER   X3.157-1987  2
 0x076.3  (0.25)   4252   (6,400)  IMFM  C   X3.116-1986  1
 0x083.81 (0.15)   4315   (8,000)  GCR   CS  X3.158-1987  1
@@ -566,6 +566,60 @@ NOTES
 density code is 0x8c.
 13. This density code (0x48) was also used for DAT-160.
 .Ed
+.Bd -literal -offset 2n
+NOTE ON QIC STREAMERS
+
+The following is a table of Data Cartridge types as used in the 1/4 inch
+tape drives such as the Archive Viper 150, Wangtek 5525ES, and Tandberg
+TDC4220 tape drives:
+
+Value Reference FormatCartridge Type  Capacity   Tracks  Length
+- - ----     --  --
+
+0x05QIC-11DC300   15MB   4300ft
+0x05QIC-11DC300XL/P   20MB   4450ft
+0x05QIC-11DC600   27MB   4600ft
+0x05  X3.136-1986   QIC-24DC615A  15MB   9150ft
+0x05  X3.136-1986   QIC-24DC300XL/P   45MB   9450ft
+0x05  X3.136-1986   QIC-24DC600A  60MB   9600ft
+0x0F  QIC-120   QIC-120   DC600A/DC6150   120MB  15   620ft
+0x10  QIC-150   QIC-150   DC600XTD/DC6150 150MB  18   620ft
+0x10  QIC-150   QIC-150   DC6250  250MB  18 1,020ft
+0x11  QIC-320   QIC-525   DC6320  320MB  26   620ft
+0x11  QIC-320   QIC-525   DC6525  525MB  26 1,020ft
+0x1E  QIC-1000C QIC-1000  DC9100/DL9135   1.0GB  30   760ft
+0x1E  QIC-1000C QIC-1000  DC9150  1.2GB  30   950ft
+0x22  QIC-2GB(C)QIC-2GB   DC9200  2.0GB  42   950ft
+0x22  QIC-2GB(C)QIC-2GB   DC9250  2.5GB  42 1,200ft
+.Ed
+.Pp
+Notes:
+.Pp
+QIC-24, QIC-120, QIC-150 use fixed blocksize of 512 bytes, QIC-525, QIC-1000
+and QIC-2GB can use blocksize of 1,024 bytes.
+DDS (DAT) drives generally use variable blocks.
+.Pp
+QIC-02 and QIC-36 are interface standards for tape drives.
+The QIC-02 and QIC-36 streamers such as the Wangtek 5250EQ are otherwise
+identical to their SCSI versions (i.e.: Wangtek 5250ES).
+.Pp
+It seems that the 150MB and larger streamers cannot write QIC-24 9 track
+formats, only read them.
+.Pp
+DC600A cartridges marked "10,000ftpi" can only be used as QIC-11, QIC-24,
+and QIC-120 format.
+DC600A cartridges marked 12,500ftpi can be used as both QIC-120 and QIC-150
+format.
+.Pp
+Some manufacturers do not use "DC" on their cartridges.
+Verbatim uses DL, Maxell uses MC, Sony uses QD, Quill uses DQ.
+.Pp
+3M/Imation & Fuji use DC.
+Thus a DL6250, MC-6250, QD6250, DQ6250 are all 

svn commit: r322785 - head/usr.sbin/camdd

2017-08-22 Thread Kenneth D. Merry
Author: ken
Date: Tue Aug 22 13:08:22 2017
New Revision: 322785
URL: https://svnweb.freebsd.org/changeset/base/322785

Log:
  Restructure camdd(8) slightly to make it easier to add support for
  additional protocols.
  
  Submitted by: Chuck Tuffli 
  MFC after:1 week
  Differential Revision:D11230

Modified:
  head/usr.sbin/camdd/camdd.c

Modified: head/usr.sbin/camdd/camdd.c
==
--- head/usr.sbin/camdd/camdd.c Tue Aug 22 11:11:49 2017(r322784)
+++ head/usr.sbin/camdd/camdd.c Tue Aug 22 13:08:22 2017(r322785)
@@ -260,6 +260,7 @@ struct camdd_buf {
 
 struct camdd_dev_pass {
int  scsi_dev_type;
+   int  protocol;
struct cam_device   *dev;
uint64_t max_sector;
uint32_t block_len;
@@ -477,6 +478,9 @@ uint32_t camdd_buf_get_len(struct camdd_buf *buf);
 void camdd_buf_add_child(struct camdd_buf *buf, struct camdd_buf *child_buf);
 int camdd_probe_tape(int fd, char *filename, uint64_t *max_iosize,
 uint64_t *max_blk, uint64_t *min_blk, uint64_t *blk_gran);
+int camdd_probe_pass_scsi(struct cam_device *cam_dev, union ccb *ccb,
+ camdd_argmask arglist, int probe_retry_count,
+ int probe_timeout, uint64_t *maxsector, uint32_t *block_len);
 struct camdd_dev *camdd_probe_file(int fd, struct camdd_io_opts *io_opts,
   int retry_count, int timeout);
 struct camdd_dev *camdd_probe_pass(struct cam_device *cam_dev,
@@ -485,7 +489,8 @@ struct camdd_dev *camdd_probe_pass(struct cam_device *
   int probe_timeout, int io_retry_count,
   int io_timeout);
 void *camdd_file_worker(void *arg);
-camdd_buf_status camdd_ccb_status(union ccb *ccb);
+camdd_buf_status camdd_ccb_status(union ccb *ccb, int protocol);
+int camdd_get_cgd(struct cam_device *device, struct ccb_getdev *cgd);
 int camdd_queue_peer_buf(struct camdd_dev *dev, struct camdd_buf *buf);
 int camdd_complete_peer_buf(struct camdd_dev *dev, struct camdd_buf *peer_buf);
 void camdd_peer_done(struct camdd_buf *buf);
@@ -1248,56 +1253,59 @@ bailout_error:
 }
 
 /*
- * Need to implement this.  Do a basic probe:
- * - Check the inquiry data, make sure we're talking to a device that we
- *   can reasonably expect to talk to -- direct, RBC, CD, WORM.
- * - Send a test unit ready, make sure the device is available.
- * - Get the capacity and block size.
+ * Get a get device CCB for the specified device.
  */
-struct camdd_dev *
-camdd_probe_pass(struct cam_device *cam_dev, struct camdd_io_opts *io_opts,
-camdd_argmask arglist, int probe_retry_count,
-int probe_timeout, int io_retry_count, int io_timeout)
+int
+camdd_get_cgd(struct cam_device *device, struct ccb_getdev *cgd)
 {
-   union ccb *ccb;
-   uint64_t maxsector;
-   uint32_t cpi_maxio, max_iosize, pass_numblocks;
-   uint32_t block_len;
-   struct scsi_read_capacity_data rcap;
-   struct scsi_read_capacity_data_long rcaplong;
-   struct camdd_dev *dev;
-   struct camdd_dev_pass *pass_dev;
-   struct kevent ke;
-   int scsi_dev_type;
+union ccb *ccb;
+   int retval = 0;
 
-   dev = NULL;
+   ccb = cam_getccb(device);
+ 
+   if (ccb == NULL) {
+   warnx("%s: couldn't allocate CCB", __func__);
+   return -1;
+   }
 
-   scsi_dev_type = SID_TYPE(_dev->inq_data);
-   maxsector = 0;
-   block_len = 0;
+   CCB_CLEAR_ALL_EXCEPT_HDR(>cgd);
 
-   /*
-* For devices that support READ CAPACITY, we'll attempt to get the
-* capacity.  Otherwise, we really don't support tape or other
-* devices via SCSI passthrough, so just return an error in that case.
-*/
-   switch (scsi_dev_type) {
-   case T_DIRECT:
-   case T_WORM:
-   case T_CDROM:
-   case T_OPTICAL:
-   case T_RBC:
-   case T_ZBC_HM:
-   break;
-   default:
-   errx(1, "Unsupported SCSI device type %d", scsi_dev_type);
-   break; /*NOTREACHED*/
+   ccb->ccb_h.func_code = XPT_GDEV_TYPE;
+ 
+   if (cam_send_ccb(device, ccb) < 0) {
+   warn("%s: error sending Get Device Information CCB", __func__);
+   cam_error_print(device, ccb, CAM_ESF_ALL,
+   CAM_EPF_ALL, stderr);
+   retval = -1;
+   goto bailout;
}
 
-   ccb = cam_getccb(cam_dev);
+   if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+   cam_error_print(device, ccb, CAM_ESF_ALL,
+   CAM_EPF_ALL, stderr);
+   retval = -1;
+   goto bailout;
+   }
 
+   bcopy(>cgd, cgd, sizeof(struct ccb_getdev));
+
+bailout:
+  

svn commit: r322661 - in stable/10/sys/dev: mpr mps

2017-08-18 Thread Kenneth D. Merry
Author: ken
Date: Fri Aug 18 15:38:08 2017
New Revision: 322661
URL: https://svnweb.freebsd.org/changeset/base/322661

Log:
  MFC r321502, r321714, r321733, r321737, r321799, r322364:
  

r321502 | scottl | 2017-07-25 19:48:13 -0600 (Tue, 25 Jul 2017) | 2 lines
  
Quiet a message that sounds far more dire than it really is.
  

r321714 | scottl | 2017-07-30 00:53:58 -0600 (Sun, 30 Jul 2017) | 13 lines
  
Split the interrupt setup code into two parts: allocation and 
configuration.
Do the allocation before requesting the IOCFacts message.  This triggers
the LSI firmware to recognize the multiqueue should be enabled if 
available.
Multiqueue isn't used by the driver yet, but this also fixes a problem 
with
the cached IOCFacts not matching latter checks, leading to potential 
problems
with error recovery.
  
As a side-effect, fetch the driver tunables as early as possible.
  
Reviewed by:slm
Obtained from:  Netflix
Differential Revision:  D9243
  

r321733 | scottl | 2017-07-30 16:34:24 -0600 (Sun, 30 Jul 2017) | 5 lines
  
Change from using underbar function names to normal function names for
the informational print functions.  Collapse the debug API a bit to be
more generic and not require as much code duplication.  While here, fix
a bug in MPS that was already fixed in MPR.
  

r321737 | scottl | 2017-07-30 18:05:49 -0600 (Sun, 30 Jul 2017) | 3 lines
  
Don't re-parse PCI IDs in order to set card-specific flags, use
the flags field in the PCIID table.
  

r321799 | scottl | 2017-07-31 10:55:56 -0600 (Mon, 31 Jul 2017) | 4 lines
  
Fix a logic bug in the split PCI interrupt code that slipped through
  
Reported by:Harry Schmalzbauer
  

r322364 | ken | 2017-08-10 08:59:17 -0600 (Thu, 10 Aug 2017) | 39 lines
  
Changes to make mps(4) and mpr(4) handle reinit with reallocation.
  
When the mps(4) and mpr(4) drivers need to reinitialize the
firmware, they sometimes need to reallocate all of the memory
allocated by the driver.  The reallocation happens whenever the IOC
Facts change.  That should only happen after a firmware upgrade.
  
If the reinitialization happens as a result of a timed out command
sent to the card, the command that timed out and triggered the
reinit may have been freed if iocfacts_allocate() reallocated all
memory.  If the caller attempts to access the command after that,
the kernel will panic because the caller will be dereferencing
freed memory.
  
The solution is to set a flag in the softc when we reallocate,
and avoid dereferencing the command strucure if we've reallocated.
  
The changes are largely the same in both drivers, since mpr(4) is a
derivative of mps(4).
  
 o In iocfacts_allocate(), if the IOC Facts have changed and we
   need to reallocate, set the REALLOCATED flag in the softc.
  
 o Change wait_command() to take a struct mps_command ** instead of
   a struct mps_command *.  This allows us to NULL out the caller's
   command pointer if we have to reinit the controller and the data
   structures get reallocated.  (The REALLOCATED flag will be set
   in the softc if that has happened.)
  
 o In every place that calls wait_command(), make sure we handle
   the case where the command is NULL after the call.
  
 o The mpr(4) driver has mpr_request_polled() which can also
   reinitialize the card.  Also check for reallocation there.
  
Reviewed by:scottl, slm
Sponsored by:   Spectra Logic
  

  
  Approved by:  re (marius)

Modified:
  stable/10/sys/dev/mpr/mpr.c
  stable/10/sys/dev/mpr/mpr_config.c
  stable/10/sys/dev/mpr/mpr_pci.c
  stable/10/sys/dev/mpr/mpr_sas.c
  stable/10/sys/dev/mpr/mpr_sas_lsi.c
  stable/10/sys/dev/mpr/mpr_table.c
  stable/10/sys/dev/mpr/mpr_table.h
  stable/10/sys/dev/mpr/mpr_user.c
  stable/10/sys/dev/mpr/mprvar.h
  stable/10/sys/dev/mps/mps.c
  stable/10/sys/dev/mps/mps_config.c
  stable/10/sys/dev/mps/mps_pci.c
  stable/10/sys/dev/mps/mps_sas.c
  stable/10/sys/dev/mps/mps_sas_lsi.c
  stable/10/sys/dev/mps/mps_table.c
  stable/10/sys/dev/mps/mps_table.h
  stable/10/sys/dev/mps/mps_user.c
  stable/10/sys/dev/mps/mpsvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mpr/mpr.c

svn commit: r322658 - in stable/11/sys/dev: mpr mps

2017-08-18 Thread Kenneth D. Merry
Author: ken
Date: Fri Aug 18 14:25:07 2017
New Revision: 322658
URL: https://svnweb.freebsd.org/changeset/base/322658

Log:
  MFC r321502, r321714, r321733, r321737, r321799, r322364:
  

r321502 | scottl | 2017-07-25 19:48:13 -0600 (Tue, 25 Jul 2017) | 2 lines
  
Quiet a message that sounds far more dire than it really is.
  

r321714 | scottl | 2017-07-30 00:53:58 -0600 (Sun, 30 Jul 2017) | 13 lines
  
Split the interrupt setup code into two parts: allocation and 
configuration.
Do the allocation before requesting the IOCFacts message.  This triggers
the LSI firmware to recognize the multiqueue should be enabled if 
available.
Multiqueue isn't used by the driver yet, but this also fixes a problem 
with
the cached IOCFacts not matching latter checks, leading to potential 
problems
with error recovery.
  
As a side-effect, fetch the driver tunables as early as possible.
  
Reviewed by:slm
Obtained from:  Netflix
Differential Revision:  D9243
  

r321733 | scottl | 2017-07-30 16:34:24 -0600 (Sun, 30 Jul 2017) | 5 lines
  
Change from using underbar function names to normal function names for
the informational print functions.  Collapse the debug API a bit to be
more generic and not require as much code duplication.  While here, fix
a bug in MPS that was already fixed in MPR.
  

r321737 | scottl | 2017-07-30 18:05:49 -0600 (Sun, 30 Jul 2017) | 3 lines
  
Don't re-parse PCI IDs in order to set card-specific flags, use
the flags field in the PCIID table.
  

r321799 | scottl | 2017-07-31 10:55:56 -0600 (Mon, 31 Jul 2017) | 4 lines
  
Fix a logic bug in the split PCI interrupt code that slipped through
  
Reported by:Harry Schmalzbauer
  

r322364 | ken | 2017-08-10 08:59:17 -0600 (Thu, 10 Aug 2017) | 39 lines
  
Changes to make mps(4) and mpr(4) handle reinit with reallocation.
  
When the mps(4) and mpr(4) drivers need to reinitialize the
firmware, they sometimes need to reallocate all of the memory
allocated by the driver.  The reallocation happens whenever the IOC
Facts change.  That should only happen after a firmware upgrade.
  
If the reinitialization happens as a result of a timed out command
sent to the card, the command that timed out and triggered the
reinit may have been freed if iocfacts_allocate() reallocated all
memory.  If the caller attempts to access the command after that,
the kernel will panic because the caller will be dereferencing
freed memory.
  
The solution is to set a flag in the softc when we reallocate,
and avoid dereferencing the command strucure if we've reallocated.
  
The changes are largely the same in both drivers, since mpr(4) is a
derivative of mps(4).
  
 o In iocfacts_allocate(), if the IOC Facts have changed and we
   need to reallocate, set the REALLOCATED flag in the softc.
  
 o Change wait_command() to take a struct mps_command ** instead of
   a struct mps_command *.  This allows us to NULL out the caller's
   command pointer if we have to reinit the controller and the data
   structures get reallocated.  (The REALLOCATED flag will be set
   in the softc if that has happened.)
  
 o In every place that calls wait_command(), make sure we handle
   the case where the command is NULL after the call.
  
 o The mpr(4) driver has mpr_request_polled() which can also
   reinitialize the card.  Also check for reallocation there.
  
Reviewed by:scottl, slm
Sponsored by:   Spectra Logic
  


Modified:
  stable/11/sys/dev/mpr/mpr.c
  stable/11/sys/dev/mpr/mpr_config.c
  stable/11/sys/dev/mpr/mpr_pci.c
  stable/11/sys/dev/mpr/mpr_sas.c
  stable/11/sys/dev/mpr/mpr_sas_lsi.c
  stable/11/sys/dev/mpr/mpr_table.c
  stable/11/sys/dev/mpr/mpr_table.h
  stable/11/sys/dev/mpr/mpr_user.c
  stable/11/sys/dev/mpr/mprvar.h
  stable/11/sys/dev/mps/mps.c
  stable/11/sys/dev/mps/mps_config.c
  stable/11/sys/dev/mps/mps_pci.c
  stable/11/sys/dev/mps/mps_sas.c
  stable/11/sys/dev/mps/mps_sas_lsi.c
  stable/11/sys/dev/mps/mps_table.c
  stable/11/sys/dev/mps/mps_table.h
  stable/11/sys/dev/mps/mps_user.c
  stable/11/sys/dev/mps/mpsvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mpr/mpr.c

svn commit: r322410 - head/usr.bin/mt

2017-08-11 Thread Kenneth D. Merry
Author: ken
Date: Fri Aug 11 18:43:52 2017
New Revision: 322410
URL: https://svnweb.freebsd.org/changeset/base/322410

Log:
  Add historical notes on QIC tape drives and fix a couple of issues in mt(1).
  
   o Density code 0x5 is also known as QIC-11, and should have a footnote
 reference.
   o Add notes on QIC tape drives from the bug report.  These may help anyone
 trying to use a QIC drive.
   o Take out a "more more" instance found by igor.
   o Bump the man page date.
  
  The PR is 14 years old, so it's past time to retire it.
  
  PR:   doc/53596
  Submitted by: t...@toybox.placo.com
  Reviewed by:  bcr
  Sponsored by: Spectra Logic

Modified:
  head/usr.bin/mt/mt.1

Modified: head/usr.bin/mt/mt.1
==
--- head/usr.bin/mt/mt.1Fri Aug 11 18:09:26 2017(r322409)
+++ head/usr.bin/mt/mt.1Fri Aug 11 18:43:52 2017(r322410)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd August 3, 2017
+.Dd August 11, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -333,7 +333,7 @@ The default protection method used is Reed-Solomon CRC
 1), as specified in ECMA-319.
 The default protection information length used with Reed-Solomon CRC is
 4 bytes.
-To enable all settings except one more more settings, specify the
+To enable all settings except one more setting, specify the
 .Fl e
 argument and then explicitly disable settings that you do not wish to
 enable.
@@ -463,7 +463,7 @@ Value  WidthTracksDensity Code Typ
 0x01   12.7  (0.5)9 32 (800)  NRZI  R   X3.22-1983   2
 0x02   12.7  (0.5)9 63   (1,600)  PER   X3.39-1986   2
 0x03   12.7  (0.5)9246   (6,250)  GCR   R   X3.54-1986   2
-0x056.3  (0.25)  4/9   315   (8,000)  GCR   C   X3.136-1986  1
+0x056.3  (0.25)  4/9   315   (8,000)  GCR   C   X3.136-1986  1,3
 0x06   12.7  (0.5)9126   (3,200)  PER   X3.157-1987  2
 0x076.3  (0.25)   4252   (6,400)  IMFM  C   X3.116-1986  1
 0x083.81 (0.15)   4315   (8,000)  GCR   CS  X3.158-1987  1
@@ -566,6 +566,60 @@ NOTES
 density code is 0x8c.
 13. This density code (0x48) was also used for DAT-160.
 .Ed
+.Bd -literal -offset 2n
+NOTE ON QIC STREAMERS
+
+The following is a table of Data Cartridge types as used in the 1/4 inch
+tape drives such as the Archive Viper 150, Wangtek 5525ES, and Tandberg
+TDC4220 tape drives:
+
+Value Reference FormatCartridge Type  Capacity   Tracks  Length
+- - ----     --  --
+
+0x05QIC-11DC300   15MB   4300ft
+0x05QIC-11DC300XL/P   20MB   4450ft
+0x05QIC-11DC600   27MB   4600ft
+0x05  X3.136-1986   QIC-24DC615A  15MB   9150ft
+0x05  X3.136-1986   QIC-24DC300XL/P   45MB   9450ft
+0x05  X3.136-1986   QIC-24DC600A  60MB   9600ft
+0x0F  QIC-120   QIC-120   DC600A/DC6150   120MB  15   620ft
+0x10  QIC-150   QIC-150   DC600XTD/DC6150 150MB  18   620ft
+0x10  QIC-150   QIC-150   DC6250  250MB  18 1,020ft
+0x11  QIC-320   QIC-525   DC6320  320MB  26   620ft
+0x11  QIC-320   QIC-525   DC6525  525MB  26 1,020ft
+0x1E  QIC-1000C QIC-1000  DC9100/DL9135   1.0GB  30   760ft
+0x1E  QIC-1000C QIC-1000  DC9150  1.2GB  30   950ft
+0x22  QIC-2GB(C)QIC-2GB   DC9200  2.0GB  42   950ft
+0x22  QIC-2GB(C)QIC-2GB   DC9250  2.5GB  42 1,200ft
+.Ed
+.Pp
+Notes:
+.Pp
+QIC-24, QIC-120, QIC-150 use fixed blocksize of 512 bytes, QIC-525, QIC-1000
+and QIC-2GB can use blocksize of 1,024 bytes.
+DDS (DAT) drives generally use variable blocks.
+.Pp
+QIC-02 and QIC-36 are interface standards for tape drives.
+The QIC-02 and QIC-36 streamers such as the Wangtek 5250EQ are otherwise
+identical to their SCSI versions (i.e.: Wangtek 5250ES).
+.Pp
+It seems that the 150MB and larger streamers cannot write QIC-24 9 track
+formats, only read them.
+.Pp
+DC600A cartridges marked "10,000ftpi" can only be used as QIC-11, QIC-24,
+and QIC-120 format.
+DC600A cartridges marked 12,500ftpi can be used as both QIC-120 and QIC-150
+format.
+.Pp
+Some manufacturers do not use "DC" on their cartridges.
+Verbatim uses DL, Maxell uses MC, Sony uses QD, Quill uses DQ.
+.Pp
+3M/Imation & Fuji use DC.
+Thus a DL6250, MC-6250, QD6250, DQ6250 are all identical media to a DC6250.
+.Pp
+QIC tape media is not "connected" to the take up reels and will de-spool
+if the tape drive has dust covering the light sensor that looks for the end
+of tape holes in the media.
 .Sh ENVIRONMENT
 .Bl -tag -width ".Ev TAPE"
 .It Ev TAPE
___
svn-src-all@freebsd.org mailing list

svn commit: r322367 - in stable/10: lib/libmt usr.bin/mt

2017-08-10 Thread Kenneth D. Merry
Author: ken
Date: Thu Aug 10 15:34:50 2017
New Revision: 322367
URL: https://svnweb.freebsd.org/changeset/base/322367

Log:
  MFC r320991, r322016:
  

r320991 | ken | 2017-07-14 10:45:46 -0600 (Fri, 14 Jul 2017) | 17 lines
  
Add IBM TS1155 density codes to libmt and the mt(1) man page.
  
These are taken directly from the density report from a TS1155
tape drive.  (Using mt getdensity)
  
lib/libmt/mtlib.c:
Add 3592B5 encrypted/unencrypted density codes, and bpmm/bpi
values.  The bpmm/bpi values are the same as TS1150, but
there are 50% more tracks.
  
usr.bin/mt/mt.1:
Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi
values and number of tracks.  Bump the man page date.
  
Sponsored by:   Spectra Logic
  

r322016 | ken | 2017-08-03 09:04:54 -0600 (Thu, 03 Aug 2017) | 6 lines
  
Oracle T1 tape drives use PRML encoding.
  
Source: Oracle T1 SCSI reference guide.
Sponsored by:   Spectra Logic
  


Modified:
  stable/10/lib/libmt/mtlib.c
  stable/10/usr.bin/mt/mt.1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libmt/mtlib.c
==
--- stable/10/lib/libmt/mtlib.c Thu Aug 10 15:34:49 2017(r322366)
+++ stable/10/lib/libmt/mtlib.c Thu Aug 10 15:34:50 2017(r322367)
@@ -641,6 +641,7 @@ static struct densities {
{ 0x53, 13452,  341681, "3592A3 (unencrypted)" },
{ 0x54, 19686,  500024, "3592A4 (unencrypted)" },
{ 0x55, 20670,  525018, "3592A5 (unencrypted)" },
+   { 0x56, 20670,  525018, "3592B5 (unencrypted)" },
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
@@ -650,6 +651,7 @@ static struct densities {
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },
{ 0x74, 19686,  500024, "3592A4 (encrypted)" },
{ 0x75, 20670,  525018, "3592A5 (encrypted)" },
+   { 0x76, 20670,  525018, "3592B5 (encrypted)" },
{ 0x8c,  1789,   45434, "EXB-8500c" },
{ 0x90,  1703,   43245, "EXB-8200c" },
{ 0, 0, 0, NULL }

Modified: stable/10/usr.bin/mt/mt.1
==
--- stable/10/usr.bin/mt/mt.1   Thu Aug 10 15:34:49 2017(r322366)
+++ stable/10/usr.bin/mt/mt.1   Thu Aug 10 15:34:50 2017(r322367)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd May 11, 2017
+.Dd August 3, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -509,15 +509,16 @@ Value  WidthTracksDensity Code Typ
 0x473.81 (0.25)   ?  6,417  (163,000)   CS  DAT-72
 0x48   12.7  (0.5)  448  5,236  (133,000) PRML  C   SDLTapeI(110) 6,8,13
 0x49   12.7  (0.5)  448  7,598  (193,000) PRML  C   SDLTapeI(160) 6,8
-0x4A   12.7  (0.5)  768  ?  C   T1A  10
-0x4B   12.7  (0.5) 1152  ?  C   T1B  10
-0x4C   12.7  (0.5) 3584  ?  C   T1C  10
-0x4D   12.7  (0.5) 4608  ?  C   T1D  10
+0x4A   12.7  (0.5)  768  ?PRML  C   T1A  10
+0x4B   12.7  (0.5) 1152  ?PRML  C   T1B  10
+0x4C   12.7  (0.5) 3584  ?PRML  C   T1C  10
+0x4D   12.7  (0.5) 4608  ?PRML  C   T1D  10
 0x51   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (unencrypted)
 0x52   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (unencrypted)
 0x53   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (unencrypted)
 0x54   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (unencrypted)
 0x55   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (unencrypted)
+0x56   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (unencrypted)
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
@@ -527,6 +528,7 @@ Value  WidthTracksDensity Code Typ
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
 0x74   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (encrypted)
 0x75   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (encrypted)
+0x76   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (encrypted)
 0x8c8.0  (0.315)  1  1,789  (45,434)  RLL   CS  EXB-8500c5,9
 0x908.0  (0.315)  1  1,703  (43,245)  RLL   CS  EXB-8200c5,9
 .Ed
___
svn-src-all@freebsd.org mailing list

svn commit: r322366 - in stable/11: lib/libmt usr.bin/mt

2017-08-10 Thread Kenneth D. Merry
Author: ken
Date: Thu Aug 10 15:34:49 2017
New Revision: 322366
URL: https://svnweb.freebsd.org/changeset/base/322366

Log:
  MFC r320991, r322016:
  

r320991 | ken | 2017-07-14 10:45:46 -0600 (Fri, 14 Jul 2017) | 17 lines
  
Add IBM TS1155 density codes to libmt and the mt(1) man page.
  
These are taken directly from the density report from a TS1155
tape drive.  (Using mt getdensity)
  
lib/libmt/mtlib.c:
Add 3592B5 encrypted/unencrypted density codes, and bpmm/bpi
values.  The bpmm/bpi values are the same as TS1150, but
there are 50% more tracks.
  
usr.bin/mt/mt.1:
Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi
values and number of tracks.  Bump the man page date.
  
Sponsored by:   Spectra Logic
  

r322016 | ken | 2017-08-03 09:04:54 -0600 (Thu, 03 Aug 2017) | 6 lines
  
Oracle T1 tape drives use PRML encoding.
  
Source: Oracle T1 SCSI reference guide.
Sponsored by:   Spectra Logic
  


Modified:
  stable/11/lib/libmt/mtlib.c
  stable/11/usr.bin/mt/mt.1
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libmt/mtlib.c
==
--- stable/11/lib/libmt/mtlib.c Thu Aug 10 15:31:45 2017(r322365)
+++ stable/11/lib/libmt/mtlib.c Thu Aug 10 15:34:49 2017(r322366)
@@ -641,6 +641,7 @@ static struct densities {
{ 0x53, 13452,  341681, "3592A3 (unencrypted)" },
{ 0x54, 19686,  500024, "3592A4 (unencrypted)" },
{ 0x55, 20670,  525018, "3592A5 (unencrypted)" },
+   { 0x56, 20670,  525018, "3592B5 (unencrypted)" },
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
@@ -650,6 +651,7 @@ static struct densities {
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },
{ 0x74, 19686,  500024, "3592A4 (encrypted)" },
{ 0x75, 20670,  525018, "3592A5 (encrypted)" },
+   { 0x76, 20670,  525018, "3592B5 (encrypted)" },
{ 0x8c,  1789,   45434, "EXB-8500c" },
{ 0x90,  1703,   43245, "EXB-8200c" },
{ 0, 0, 0, NULL }

Modified: stable/11/usr.bin/mt/mt.1
==
--- stable/11/usr.bin/mt/mt.1   Thu Aug 10 15:31:45 2017(r322365)
+++ stable/11/usr.bin/mt/mt.1   Thu Aug 10 15:34:49 2017(r322366)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd May 11, 2017
+.Dd August 3, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -509,15 +509,16 @@ Value  WidthTracksDensity Code Typ
 0x473.81 (0.25)   ?  6,417  (163,000)   CS  DAT-72
 0x48   12.7  (0.5)  448  5,236  (133,000) PRML  C   SDLTapeI(110) 6,8,13
 0x49   12.7  (0.5)  448  7,598  (193,000) PRML  C   SDLTapeI(160) 6,8
-0x4A   12.7  (0.5)  768  ?  C   T1A  10
-0x4B   12.7  (0.5) 1152  ?  C   T1B  10
-0x4C   12.7  (0.5) 3584  ?  C   T1C  10
-0x4D   12.7  (0.5) 4608  ?  C   T1D  10
+0x4A   12.7  (0.5)  768  ?PRML  C   T1A  10
+0x4B   12.7  (0.5) 1152  ?PRML  C   T1B  10
+0x4C   12.7  (0.5) 3584  ?PRML  C   T1C  10
+0x4D   12.7  (0.5) 4608  ?PRML  C   T1D  10
 0x51   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (unencrypted)
 0x52   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (unencrypted)
 0x53   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (unencrypted)
 0x54   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (unencrypted)
 0x55   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (unencrypted)
+0x56   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (unencrypted)
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
@@ -527,6 +528,7 @@ Value  WidthTracksDensity Code Typ
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
 0x74   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (encrypted)
 0x75   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (encrypted)
+0x76   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (encrypted)
 0x8c8.0  (0.315)  1  1,789  (45,434)  RLL   CS  EXB-8500c5,9
 0x908.0  (0.315)  1  1,703  (43,245)  RLL   CS  EXB-8200c5,9
 .Ed
___
svn-src-all@freebsd.org mailing list

svn commit: r322364 - in head/sys/dev: mpr mps

2017-08-10 Thread Kenneth D. Merry
Author: ken
Date: Thu Aug 10 14:59:17 2017
New Revision: 322364
URL: https://svnweb.freebsd.org/changeset/base/322364

Log:
  Changes to make mps(4) and mpr(4) handle reinit with reallocation.
  
  When the mps(4) and mpr(4) drivers need to reinitialize the
  firmware, they sometimes need to reallocate all of the memory
  allocated by the driver.  The reallocation happens whenever the IOC
  Facts change.  That should only happen after a firmware upgrade.
  
  If the reinitialization happens as a result of a timed out command
  sent to the card, the command that timed out and triggered the
  reinit may have been freed if iocfacts_allocate() reallocated all
  memory.  If the caller attempts to access the command after that,
  the kernel will panic because the caller will be dereferencing
  freed memory.
  
  The solution is to set a flag in the softc when we reallocate,
  and avoid dereferencing the command strucure if we've reallocated.
  
  The changes are largely the same in both drivers, since mpr(4) is a
  derivative of mps(4).
  
   o In iocfacts_allocate(), if the IOC Facts have changed and we
 need to reallocate, set the REALLOCATED flag in the softc.
  
   o Change wait_command() to take a struct mps_command ** instead of
 a struct mps_command *.  This allows us to NULL out the caller's
 command pointer if we have to reinit the controller and the data
 structures get reallocated.  (The REALLOCATED flag will be set
 in the softc if that has happened.)
  
   o In every place that calls wait_command(), make sure we handle
 the case where the command is NULL after the call.
  
   o The mpr(4) driver has mpr_request_polled() which can also
 reinitialize the card.  Also check for reallocation there.
  
  Reviewed by:  scottl, slm
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mpr/mpr_config.c
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mpr/mpr_sas_lsi.c
  head/sys/dev/mpr/mpr_user.c
  head/sys/dev/mpr/mprvar.h
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_config.c
  head/sys/dev/mps/mps_sas.c
  head/sys/dev/mps/mps_sas_lsi.c
  head/sys/dev/mps/mps_user.c
  head/sys/dev/mps/mpsvar.h

Modified: head/sys/dev/mpr/mpr.c
==
--- head/sys/dev/mpr/mpr.c  Thu Aug 10 14:54:36 2017(r322363)
+++ head/sys/dev/mpr/mpr.c  Thu Aug 10 14:59:17 2017(r322364)
@@ -436,6 +436,8 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at
 
/* Only deallocate and reallocate if relevant IOC Facts have changed */
reallocating = FALSE;
+   sc->mpr_flags &= ~MPR_FLAGS_REALLOCATED;
+
if ((!attaching) &&
((saved_facts.MsgVersion != sc->facts->MsgVersion) ||
(saved_facts.HeaderVersion != sc->facts->HeaderVersion) ||
@@ -458,6 +460,9 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at
(saved_facts.MaxPersistentEntries !=
sc->facts->MaxPersistentEntries))) {
reallocating = TRUE;
+
+   /* Record that we reallocated everything */
+   sc->mpr_flags |= MPR_FLAGS_REALLOCATED;
}
 
/*
@@ -2229,8 +2234,8 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve
 uint8_t *mask)
 {
MPI2_EVENT_NOTIFICATION_REQUEST *evtreq;
-   MPI2_EVENT_NOTIFICATION_REPLY *reply;
-   struct mpr_command *cm;
+   MPI2_EVENT_NOTIFICATION_REPLY *reply = NULL;
+   struct mpr_command *cm = NULL;
struct mpr_event_handle *eh;
int error, i;
 
@@ -2263,8 +2268,9 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve
cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
cm->cm_data = NULL;
 
-   error = mpr_request_polled(sc, cm);
-   reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply;
+   error = mpr_request_polled(sc, );
+   if (cm != NULL)
+   reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply;
if ((reply == NULL) ||
(reply->IOCStatus & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS)
error = ENXIO;
@@ -2274,7 +2280,8 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve
 
mpr_dprint(sc, MPR_TRACE, "%s finished error %d\n", __func__, error);
 
-   mpr_free_command(sc, cm);
+   if (cm != NULL)
+   mpr_free_command(sc, cm);
return (error);
 }
 
@@ -3260,11 +3267,12 @@ mpr_map_command(struct mpr_softc *sc, struct mpr_comma
  * be executed and enqueued automatically.  Other errors come from msleep().
  */
 int
-mpr_wait_command(struct mpr_softc *sc, struct mpr_command *cm, int timeout,
+mpr_wait_command(struct mpr_softc *sc, struct mpr_command **cmp, int timeout,
 int sleep_flag)
 {
int error, rc;
struct timeval cur_time, start_time;
+   struct mpr_command *cm = *cmp;
 
if (sc->mpr_flags & MPR_FLAGS_DIAGRESET) 
return  

svn commit: r322016 - head/usr.bin/mt

2017-08-03 Thread Kenneth D. Merry
Author: ken
Date: Thu Aug  3 15:04:54 2017
New Revision: 322016
URL: https://svnweb.freebsd.org/changeset/base/322016

Log:
  Oracle T1 tape drives use PRML encoding.
  
  Source:   Oracle T1 SCSI reference guide.
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/usr.bin/mt/mt.1

Modified: head/usr.bin/mt/mt.1
==
--- head/usr.bin/mt/mt.1Thu Aug  3 14:43:41 2017(r322015)
+++ head/usr.bin/mt/mt.1Thu Aug  3 15:04:54 2017(r322016)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd July 14, 2017
+.Dd August 3, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -509,10 +509,10 @@ Value  WidthTracksDensity Code Typ
 0x473.81 (0.25)   ?  6,417  (163,000)   CS  DAT-72
 0x48   12.7  (0.5)  448  5,236  (133,000) PRML  C   SDLTapeI(110) 6,8,13
 0x49   12.7  (0.5)  448  7,598  (193,000) PRML  C   SDLTapeI(160) 6,8
-0x4A   12.7  (0.5)  768  ?  C   T1A  10
-0x4B   12.7  (0.5) 1152  ?  C   T1B  10
-0x4C   12.7  (0.5) 3584  ?  C   T1C  10
-0x4D   12.7  (0.5) 4608  ?  C   T1D  10
+0x4A   12.7  (0.5)  768  ?PRML  C   T1A  10
+0x4B   12.7  (0.5) 1152  ?PRML  C   T1B  10
+0x4C   12.7  (0.5) 3584  ?PRML  C   T1C  10
+0x4D   12.7  (0.5) 4608  ?PRML  C   T1D  10
 0x51   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (unencrypted)
 0x52   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (unencrypted)
 0x53   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (unencrypted)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r321944 - stable/11/sys/dev/isp

2017-08-02 Thread Kenneth D. Merry
Author: ken
Date: Wed Aug  2 20:24:26 2017
New Revision: 321944
URL: https://svnweb.freebsd.org/changeset/base/321944

Log:
  MFC r321622, r321623:
  

r321622 | ken | 2017-07-27 09:33:57 -0600 (Thu, 27 Jul 2017) | 44 lines
  
Fix probing FC targets with hard addressing turned on.
  
This largely reverts FreeBSD SVN change 289937 from October 25th, 2015.
  
The intent of that change was to keep loop IDs persistent across
chip reinits.
  
The problem is that the change turned on the PREVLOOP /
PREV_ADDRESS bit (bit 7 in Firmware Options 2), which tells the
Qlogic chip to not participate in the loop if it can't get the
requested loop address.  It also turned off soft addressing on 2400
(4Gb) and newer controllers.
  
The isp(4) driver defaults to loop address 0, and the tape drives
I have tested default to loop address 0 if hard addressing is turned
on.  So when hard loop addressing is turned on on the drive, the isp(4)
driver just refuses to participate in the loop.
  
The solution is to largely revert that change.  I left some elements
in place that are related to virtual ports, since they were new.
  
This does work with IBM tape drives with hard and soft addressing
turned on.  I have tested it with 4Gb, 8Gb, and 16Gb controllers.
  
sys/dev/isp.c:
Largely revert FreeBSD SVN change 289937.  I left the
ispmbox.h changes in place.
  
Don't use the PREV_ADDRESS bit on initialization.  It tells
the chip to not participate if it can't get the requested
loop ID.
  
Do use soft addressing on 2400 and newer chips.
  
Use hard addressing when the user has requested a specific
initiator ID.  (hint.isp.X.iid=N in /boot/loader.conf)
  
Leave some of the virtual port options from that change in
place, but don't turn on the PREV_ADDRESS bit.
  
Reviewed by:mav
Sponsored by:   Spectra Logic
  

r321623 | ken | 2017-07-27 09:51:56 -0600 (Thu, 27 Jul 2017) | 6 lines
  
Remove duplicate assignments from r321622.
  
Submitted by:   mav
Sponsored by:   Spectra Logic
  


Modified:
  stable/11/sys/dev/isp/isp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp.c
==
--- stable/11/sys/dev/isp/isp.c Wed Aug  2 20:23:25 2017(r321943)
+++ stable/11/sys/dev/isp/isp.c Wed Aug  2 20:24:26 2017(r321944)
@@ -1631,6 +1631,7 @@ isp_fibre_init(ispsoftc_t *isp)
fcparam *fcp;
isp_icb_t local, *icbp = 
mbreg_t mbs;
+   int ownloopid;
 
/*
 * We only support one channel on non-24XX cards
@@ -1709,15 +1710,22 @@ isp_fibre_init(ispsoftc_t *isp)
}
icbp->icb_retry_delay = fcp->isp_retry_delay;
icbp->icb_retry_count = fcp->isp_retry_count;
-   if (fcp->isp_loopid < LOCAL_LOOP_LIM) {
-   icbp->icb_hardaddr = fcp->isp_loopid;
-   if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
-   icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
-   else
-   icbp->icb_fwoptions |= ICBOPT_PREV_ADDRESS;
+   icbp->icb_hardaddr = fcp->isp_loopid;
+   ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
+   if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) {
+   icbp->icb_hardaddr = 0;
+   ownloopid = 0;
}
 
/*
+* Our life seems so much better with 2200s and later with
+* the latest f/w if we set Hard Address.
+*/
+   if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) {
+   icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
+   }
+
+   /*
 * Right now we just set extended options to prefer point-to-point
 * over loop based upon some soft config options.
 *
@@ -1951,6 +1959,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
isp_icb_2400_t local, *icbp = 
mbreg_t mbs;
int chan;
+   int ownloopid = 0;
 
/*
 * Check to see whether all channels have *some* kind of role
@@ -2023,14 +2032,17 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_xchgcnt >>= 1;
}
 
-   if (fcp->isp_loopid < LOCAL_LOOP_LIM) {
-   icbp->icb_hardaddr = fcp->isp_loopid;
-   if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
-   icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
-   else
-   icbp->icb_fwoptions1 |= ICB2400_OPT1_PREV_ADDRESS;
+
+   ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
+   icbp->icb_hardaddr = fcp->isp_loopid;
+   if 

svn commit: r321945 - stable/10/sys/dev/isp

2017-08-02 Thread Kenneth D. Merry
Author: ken
Date: Wed Aug  2 20:24:28 2017
New Revision: 321945
URL: https://svnweb.freebsd.org/changeset/base/321945

Log:
  MFC r321622, r321623:
  

r321622 | ken | 2017-07-27 09:33:57 -0600 (Thu, 27 Jul 2017) | 44 lines
  
Fix probing FC targets with hard addressing turned on.
  
This largely reverts FreeBSD SVN change 289937 from October 25th, 2015.
  
The intent of that change was to keep loop IDs persistent across
chip reinits.
  
The problem is that the change turned on the PREVLOOP /
PREV_ADDRESS bit (bit 7 in Firmware Options 2), which tells the
Qlogic chip to not participate in the loop if it can't get the
requested loop address.  It also turned off soft addressing on 2400
(4Gb) and newer controllers.
  
The isp(4) driver defaults to loop address 0, and the tape drives
I have tested default to loop address 0 if hard addressing is turned
on.  So when hard loop addressing is turned on on the drive, the isp(4)
driver just refuses to participate in the loop.
  
The solution is to largely revert that change.  I left some elements
in place that are related to virtual ports, since they were new.
  
This does work with IBM tape drives with hard and soft addressing
turned on.  I have tested it with 4Gb, 8Gb, and 16Gb controllers.
  
sys/dev/isp.c:
Largely revert FreeBSD SVN change 289937.  I left the
ispmbox.h changes in place.
  
Don't use the PREV_ADDRESS bit on initialization.  It tells
the chip to not participate if it can't get the requested
loop ID.
  
Do use soft addressing on 2400 and newer chips.
  
Use hard addressing when the user has requested a specific
initiator ID.  (hint.isp.X.iid=N in /boot/loader.conf)
  
Leave some of the virtual port options from that change in
place, but don't turn on the PREV_ADDRESS bit.
  
Reviewed by:mav
Sponsored by:   Spectra Logic
  

r321623 | ken | 2017-07-27 09:51:56 -0600 (Thu, 27 Jul 2017) | 6 lines
  
Remove duplicate assignments from r321622.
  
Submitted by:   mav
Sponsored by:   Spectra Logic
  


Modified:
  stable/10/sys/dev/isp/isp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp.c
==
--- stable/10/sys/dev/isp/isp.c Wed Aug  2 20:24:26 2017(r321944)
+++ stable/10/sys/dev/isp/isp.c Wed Aug  2 20:24:28 2017(r321945)
@@ -1632,6 +1632,7 @@ isp_fibre_init(ispsoftc_t *isp)
fcparam *fcp;
isp_icb_t local, *icbp = 
mbreg_t mbs;
+   int ownloopid;
 
/*
 * We only support one channel on non-24XX cards
@@ -1710,15 +1711,22 @@ isp_fibre_init(ispsoftc_t *isp)
}
icbp->icb_retry_delay = fcp->isp_retry_delay;
icbp->icb_retry_count = fcp->isp_retry_count;
-   if (fcp->isp_loopid < LOCAL_LOOP_LIM) {
-   icbp->icb_hardaddr = fcp->isp_loopid;
-   if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
-   icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
-   else
-   icbp->icb_fwoptions |= ICBOPT_PREV_ADDRESS;
+   icbp->icb_hardaddr = fcp->isp_loopid;
+   ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
+   if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) {
+   icbp->icb_hardaddr = 0;
+   ownloopid = 0;
}
 
/*
+* Our life seems so much better with 2200s and later with
+* the latest f/w if we set Hard Address.
+*/
+   if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) {
+   icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
+   }
+
+   /*
 * Right now we just set extended options to prefer point-to-point
 * over loop based upon some soft config options.
 *
@@ -1952,6 +1960,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
isp_icb_2400_t local, *icbp = 
mbreg_t mbs;
int chan;
+   int ownloopid = 0;
 
/*
 * Check to see whether all channels have *some* kind of role
@@ -2024,14 +2033,17 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_xchgcnt >>= 1;
}
 
-   if (fcp->isp_loopid < LOCAL_LOOP_LIM) {
-   icbp->icb_hardaddr = fcp->isp_loopid;
-   if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
-   icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
-   else
-   icbp->icb_fwoptions1 |= ICB2400_OPT1_PREV_ADDRESS;
+
+   ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
+   icbp->icb_hardaddr = fcp->isp_loopid;
+   if 

svn commit: r321623 - head/sys/dev/isp

2017-07-27 Thread Kenneth D. Merry
Author: ken
Date: Thu Jul 27 15:51:56 2017
New Revision: 321623
URL: https://svnweb.freebsd.org/changeset/base/321623

Log:
  Remove duplicate assignments from r321622.
  
  Submitted by: mav
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/dev/isp/isp.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Thu Jul 27 15:33:57 2017(r321622)
+++ head/sys/dev/isp/isp.c  Thu Jul 27 15:51:56 2017(r321623)
@@ -2043,7 +2043,6 @@ isp_fibre_init_2400(ispsoftc_t *isp)
if (ownloopid)
icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
 
-   icbp->icb_fwoptions2 = fcp->isp_xfwoptions;
if (isp->isp_confopts & ISP_CFG_NOFCTAPE) {
icbp->icb_fwoptions2 &= ~ICB2400_OPT2_FCTAPE;
}
@@ -2106,7 +2105,6 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_fwoptions2 |= ICB2400_OPT2_ENA_IHA;
}
 
-   icbp->icb_fwoptions3 = fcp->isp_zfwoptions;
if ((icbp->icb_fwoptions3 & ICB2400_OPT3_RSPSZ_MASK) == 0) {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RSPSZ_24;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r321622 - head/sys/dev/isp

2017-07-27 Thread Kenneth D. Merry
Author: ken
Date: Thu Jul 27 15:33:57 2017
New Revision: 321622
URL: https://svnweb.freebsd.org/changeset/base/321622

Log:
  Fix probing FC targets with hard addressing turned on.
  
  This largely reverts FreeBSD SVN change 289937 from October 25th, 2015.
  
  The intent of that change was to keep loop IDs persistent across
  chip reinits.
  
  The problem is that the change turned on the PREVLOOP /
  PREV_ADDRESS bit (bit 7 in Firmware Options 2), which tells the
  Qlogic chip to not participate in the loop if it can't get the
  requested loop address.  It also turned off soft addressing on 2400
  (4Gb) and newer controllers.
  
  The isp(4) driver defaults to loop address 0, and the tape drives
  I have tested default to loop address 0 if hard addressing is turned
  on.  So when hard loop addressing is turned on on the drive, the isp(4)
  driver just refuses to participate in the loop.
  
  The solution is to largely revert that change.  I left some elements
  in place that are related to virtual ports, since they were new.
  
  This does work with IBM tape drives with hard and soft addressing
  turned on.  I have tested it with 4Gb, 8Gb, and 16Gb controllers.
  
  sys/dev/isp.c:
Largely revert FreeBSD SVN change 289937.  I left the
ispmbox.h changes in place.
  
Don't use the PREV_ADDRESS bit on initialization.  It tells
the chip to not participate if it can't get the requested
loop ID.
  
Do use soft addressing on 2400 and newer chips.
  
Use hard addressing when the user has requested a specific
initiator ID.  (hint.isp.X.iid=N in /boot/loader.conf)
  
Leave some of the virtual port options from that change in
place, but don't turn on the PREV_ADDRESS bit.
  
  Reviewed by:  mav
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/dev/isp/isp.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Thu Jul 27 15:06:34 2017(r321621)
+++ head/sys/dev/isp/isp.c  Thu Jul 27 15:33:57 2017(r321622)
@@ -1631,6 +1631,7 @@ isp_fibre_init(ispsoftc_t *isp)
fcparam *fcp;
isp_icb_t local, *icbp = 
mbreg_t mbs;
+   int ownloopid;
 
/*
 * We only support one channel on non-24XX cards
@@ -1709,15 +1710,22 @@ isp_fibre_init(ispsoftc_t *isp)
}
icbp->icb_retry_delay = fcp->isp_retry_delay;
icbp->icb_retry_count = fcp->isp_retry_count;
-   if (fcp->isp_loopid < LOCAL_LOOP_LIM) {
-   icbp->icb_hardaddr = fcp->isp_loopid;
-   if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
-   icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
-   else
-   icbp->icb_fwoptions |= ICBOPT_PREV_ADDRESS;
+   icbp->icb_hardaddr = fcp->isp_loopid;
+   ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
+   if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) {
+   icbp->icb_hardaddr = 0;
+   ownloopid = 0;
}
 
/*
+* Our life seems so much better with 2200s and later with
+* the latest f/w if we set Hard Address.
+*/
+   if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) {
+   icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
+   }
+
+   /*
 * Right now we just set extended options to prefer point-to-point
 * over loop based upon some soft config options.
 *
@@ -1951,6 +1959,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
isp_icb_2400_t local, *icbp = 
mbreg_t mbs;
int chan;
+   int ownloopid = 0;
 
/*
 * Check to see whether all channels have *some* kind of role
@@ -2023,14 +2032,18 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_xchgcnt >>= 1;
}
 
-   if (fcp->isp_loopid < LOCAL_LOOP_LIM) {
-   icbp->icb_hardaddr = fcp->isp_loopid;
-   if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
-   icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
-   else
-   icbp->icb_fwoptions1 |= ICB2400_OPT1_PREV_ADDRESS;
+
+   ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
+   icbp->icb_hardaddr = fcp->isp_loopid;
+   if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) {
+   icbp->icb_hardaddr = 0;
+   ownloopid = 0;
}
 
+   if (ownloopid)
+   icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
+
+   icbp->icb_fwoptions2 = fcp->isp_xfwoptions;
if (isp->isp_confopts & ISP_CFG_NOFCTAPE) {
icbp->icb_fwoptions2 &= ~ICB2400_OPT2_FCTAPE;
}
@@ -2093,6 +2106,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_fwoptions2 |= ICB2400_OPT2_ENA_IHA;
}
 
+   icbp->icb_fwoptions3 = fcp->isp_zfwoptions;
if ((icbp->icb_fwoptions3 & ICB2400_OPT3_RSPSZ_MASK) 

svn commit: r321416 - in stable/10/sys/dev: mpr mps

2017-07-24 Thread Kenneth D. Merry
Author: ken
Date: Mon Jul 24 14:42:45 2017
New Revision: 321416
URL: https://svnweb.freebsd.org/changeset/base/321416

Log:
  MFC r321207:

r321207 | ken | 2017-07-19 09:39:01 -0600 (Wed, 19 Jul 2017) | 14 lines
  
Fix spurious timeouts on commands sent to mps(4) and mpr(4) controllers.
  
mps_wait_command() and mpr_wait_command() were using getmicrotime() to
determine elapsed time when checking for a timeout in polled mode.
getmicrotime() isn't guaranteed to monotonically increase, and that
caused spurious timeouts occasionally.
  
Switch to using getmicrouptime(), which does increase monotonically.
This fixes the spurious timeouts in my test case.
  

  Reviewed by:  slm, scottl
  Sponsored by: Spectra Logic

Modified:
  stable/10/sys/dev/mpr/mpr.c
  stable/10/sys/dev/mps/mps.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mpr/mpr.c
==
--- stable/10/sys/dev/mpr/mpr.c Mon Jul 24 14:42:43 2017(r321415)
+++ stable/10/sys/dev/mpr/mpr.c Mon Jul 24 14:42:45 2017(r321416)
@@ -3286,9 +3286,17 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm
if (curthread->td_pflags & TDP_NOSLEEPING)
 #endif //__FreeBSD_version >= 129
sleep_flag = NO_SLEEP;
-   getmicrotime(_time);
+   getmicrouptime(_time);
if (mtx_owned(>mpr_mtx) && sleep_flag == CAN_SLEEP) {
error = msleep(cm, >mpr_mtx, 0, "mprwait", timeout*hz);
+   if (error == EWOULDBLOCK) {
+   /*
+* Record the actual elapsed time in the case of a
+* timeout for the message below.
+*/
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   }
} else {
while ((cm->cm_flags & MPR_CM_FLAGS_COMPLETE) == 0) {
mpr_intr_locked(sc);
@@ -3297,8 +3305,9 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm
else
DELAY(5);

-   getmicrotime(_time);
-   if ((cur_time.tv_sec - start_time.tv_sec) > timeout) {
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   if (cur_time.tv_sec > timeout) {
error = EWOULDBLOCK;
break;
}
@@ -3306,7 +3315,9 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm
}
 
if (error == EWOULDBLOCK) {
-   mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s\n", __func__);
+   mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s, timeout=%d,"
+   " elapsed=%jd\n", __func__, timeout,
+   (intmax_t)cur_time.tv_sec);
rc = mpr_reinit(sc);
mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" :
"failed");

Modified: stable/10/sys/dev/mps/mps.c
==
--- stable/10/sys/dev/mps/mps.c Mon Jul 24 14:42:43 2017(r321415)
+++ stable/10/sys/dev/mps/mps.c Mon Jul 24 14:42:45 2017(r321416)
@@ -2551,10 +2551,18 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm
 */
if (curthread->td_no_sleeping != 0)
sleep_flag = NO_SLEEP;
-   getmicrotime(_time);
+   getmicrouptime(_time);
if (mtx_owned(>mps_mtx) && sleep_flag == CAN_SLEEP) {
cm->cm_flags |= MPS_CM_FLAGS_WAKEUP;
error = msleep(cm, >mps_mtx, 0, "mpswait", timeout*hz);
+   if (error == EWOULDBLOCK) {
+   /*
+* Record the actual elapsed time in the case of a
+* timeout for the message below.
+*/
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   }
} else {
while ((cm->cm_flags & MPS_CM_FLAGS_COMPLETE) == 0) {
mps_intr_locked(sc);
@@ -2563,8 +2571,9 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm
else
DELAY(5);

-   getmicrotime(_time);
-   if ((cur_time.tv_sec - start_time.tv_sec) > timeout) {
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   if (cur_time.tv_sec > timeout) {
error = EWOULDBLOCK;
break;
   

svn commit: r321415 - in stable/11/sys/dev: mpr mps

2017-07-24 Thread Kenneth D. Merry
Author: ken
Date: Mon Jul 24 14:42:43 2017
New Revision: 321415
URL: https://svnweb.freebsd.org/changeset/base/321415

Log:
  MFC r321207:

r321207 | ken | 2017-07-19 09:39:01 -0600 (Wed, 19 Jul 2017) | 14 lines
  
Fix spurious timeouts on commands sent to mps(4) and mpr(4) controllers.
  
mps_wait_command() and mpr_wait_command() were using getmicrotime() to
determine elapsed time when checking for a timeout in polled mode.
getmicrotime() isn't guaranteed to monotonically increase, and that
caused spurious timeouts occasionally.
  
Switch to using getmicrouptime(), which does increase monotonically.
This fixes the spurious timeouts in my test case.
  

  Reviewed by:  slm, scottl
  Sponsored by: Spectra Logic

Modified:
  stable/11/sys/dev/mpr/mpr.c
  stable/11/sys/dev/mps/mps.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mpr/mpr.c
==
--- stable/11/sys/dev/mpr/mpr.c Mon Jul 24 06:49:57 2017(r321414)
+++ stable/11/sys/dev/mpr/mpr.c Mon Jul 24 14:42:43 2017(r321415)
@@ -3286,9 +3286,17 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm
if (curthread->td_pflags & TDP_NOSLEEPING)
 #endif //__FreeBSD_version >= 129
sleep_flag = NO_SLEEP;
-   getmicrotime(_time);
+   getmicrouptime(_time);
if (mtx_owned(>mpr_mtx) && sleep_flag == CAN_SLEEP) {
error = msleep(cm, >mpr_mtx, 0, "mprwait", timeout*hz);
+   if (error == EWOULDBLOCK) {
+   /*
+* Record the actual elapsed time in the case of a
+* timeout for the message below.
+*/
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   }
} else {
while ((cm->cm_flags & MPR_CM_FLAGS_COMPLETE) == 0) {
mpr_intr_locked(sc);
@@ -3297,8 +3305,9 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm
else
DELAY(5);

-   getmicrotime(_time);
-   if ((cur_time.tv_sec - start_time.tv_sec) > timeout) {
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   if (cur_time.tv_sec > timeout) {
error = EWOULDBLOCK;
break;
}
@@ -3306,7 +3315,9 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm
}
 
if (error == EWOULDBLOCK) {
-   mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s\n", __func__);
+   mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s, timeout=%d,"
+   " elapsed=%jd\n", __func__, timeout,
+   (intmax_t)cur_time.tv_sec);
rc = mpr_reinit(sc);
mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" :
"failed");

Modified: stable/11/sys/dev/mps/mps.c
==
--- stable/11/sys/dev/mps/mps.c Mon Jul 24 06:49:57 2017(r321414)
+++ stable/11/sys/dev/mps/mps.c Mon Jul 24 14:42:43 2017(r321415)
@@ -2551,10 +2551,18 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm
 */
if (curthread->td_no_sleeping != 0)
sleep_flag = NO_SLEEP;
-   getmicrotime(_time);
+   getmicrouptime(_time);
if (mtx_owned(>mps_mtx) && sleep_flag == CAN_SLEEP) {
cm->cm_flags |= MPS_CM_FLAGS_WAKEUP;
error = msleep(cm, >mps_mtx, 0, "mpswait", timeout*hz);
+   if (error == EWOULDBLOCK) {
+   /*
+* Record the actual elapsed time in the case of a
+* timeout for the message below.
+*/
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   }
} else {
while ((cm->cm_flags & MPS_CM_FLAGS_COMPLETE) == 0) {
mps_intr_locked(sc);
@@ -2563,8 +2571,9 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm
else
DELAY(5);

-   getmicrotime(_time);
-   if ((cur_time.tv_sec - start_time.tv_sec) > timeout) {
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   if (cur_time.tv_sec > timeout) {
error = EWOULDBLOCK;
break;
   

svn commit: r321207 - in head/sys/dev: mpr mps

2017-07-19 Thread Kenneth D. Merry
Author: ken
Date: Wed Jul 19 15:39:01 2017
New Revision: 321207
URL: https://svnweb.freebsd.org/changeset/base/321207

Log:
  Fix spurious timeouts on commands sent to mps(4) and mpr(4) controllers.
  
  mps_wait_command() and mpr_wait_command() were using getmicrotime() to
  determine elapsed time when checking for a timeout in polled mode.
  getmicrotime() isn't guaranteed to monotonically increase, and that
  caused spurious timeouts occasionally.
  
  Switch to using getmicrouptime(), which does increase monotonically.
  This fixes the spurious timeouts in my test case.
  
  Reviewed by:  slm, scottl
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mps/mps.c

Modified: head/sys/dev/mpr/mpr.c
==
--- head/sys/dev/mpr/mpr.c  Wed Jul 19 15:22:10 2017(r321206)
+++ head/sys/dev/mpr/mpr.c  Wed Jul 19 15:39:01 2017(r321207)
@@ -3286,9 +3286,17 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm
if (curthread->td_pflags & TDP_NOSLEEPING)
 #endif //__FreeBSD_version >= 129
sleep_flag = NO_SLEEP;
-   getmicrotime(_time);
+   getmicrouptime(_time);
if (mtx_owned(>mpr_mtx) && sleep_flag == CAN_SLEEP) {
error = msleep(cm, >mpr_mtx, 0, "mprwait", timeout*hz);
+   if (error == EWOULDBLOCK) {
+   /*
+* Record the actual elapsed time in the case of a
+* timeout for the message below.
+*/
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   }
} else {
while ((cm->cm_flags & MPR_CM_FLAGS_COMPLETE) == 0) {
mpr_intr_locked(sc);
@@ -3297,8 +3305,9 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm
else
DELAY(5);

-   getmicrotime(_time);
-   if ((cur_time.tv_sec - start_time.tv_sec) > timeout) {
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   if (cur_time.tv_sec > timeout) {
error = EWOULDBLOCK;
break;
}
@@ -3306,7 +3315,9 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm
}
 
if (error == EWOULDBLOCK) {
-   mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s\n", __func__);
+   mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s, timeout=%d,"
+   " elapsed=%jd\n", __func__, timeout,
+   (intmax_t)cur_time.tv_sec);
rc = mpr_reinit(sc);
mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" :
"failed");

Modified: head/sys/dev/mps/mps.c
==
--- head/sys/dev/mps/mps.c  Wed Jul 19 15:22:10 2017(r321206)
+++ head/sys/dev/mps/mps.c  Wed Jul 19 15:39:01 2017(r321207)
@@ -2551,10 +2551,18 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm
 */
if (curthread->td_no_sleeping != 0)
sleep_flag = NO_SLEEP;
-   getmicrotime(_time);
+   getmicrouptime(_time);
if (mtx_owned(>mps_mtx) && sleep_flag == CAN_SLEEP) {
cm->cm_flags |= MPS_CM_FLAGS_WAKEUP;
error = msleep(cm, >mps_mtx, 0, "mpswait", timeout*hz);
+   if (error == EWOULDBLOCK) {
+   /*
+* Record the actual elapsed time in the case of a
+* timeout for the message below.
+*/
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   }
} else {
while ((cm->cm_flags & MPS_CM_FLAGS_COMPLETE) == 0) {
mps_intr_locked(sc);
@@ -2563,8 +2571,9 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm
else
DELAY(5);

-   getmicrotime(_time);
-   if ((cur_time.tv_sec - start_time.tv_sec) > timeout) {
+   getmicrouptime(_time);
+   timevalsub(_time, _time);
+   if (cur_time.tv_sec > timeout) {
error = EWOULDBLOCK;
break;
}
@@ -2572,7 +2581,9 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm
}
 
if (error == EWOULDBLOCK) {
-   mps_dprint(sc, MPS_FAULT, "Calling Reinit from %s\n", __func__);
+   mps_dprint(sc, MPS_FAULT, "Calling Reinit from %s, timeout=%d,"
+  

svn commit: r320991 - in head: lib/libmt usr.bin/mt

2017-07-14 Thread Kenneth D. Merry
Author: ken
Date: Fri Jul 14 16:45:46 2017
New Revision: 320991
URL: https://svnweb.freebsd.org/changeset/base/320991

Log:
  Add IBM TS1155 density codes to libmt and the mt(1) man page.
  
  These are taken directly from the density report from a TS1155
  tape drive.  (Using mt getdensity)
  
  lib/libmt/mtlib.c:
Add 3592B5 encrypted/unencrypted density codes, and bpmm/bpi
values.  The bpmm/bpi values are the same as TS1150, but
there are 50% more tracks.
  
  usr.bin/mt/mt.1:
Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi
values and number of tracks.  Bump the man page date.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/lib/libmt/mtlib.c
  head/usr.bin/mt/mt.1

Modified: head/lib/libmt/mtlib.c
==
--- head/lib/libmt/mtlib.c  Fri Jul 14 16:05:54 2017(r320990)
+++ head/lib/libmt/mtlib.c  Fri Jul 14 16:45:46 2017(r320991)
@@ -641,6 +641,7 @@ static struct densities {
{ 0x53, 13452,  341681, "3592A3 (unencrypted)" },
{ 0x54, 19686,  500024, "3592A4 (unencrypted)" },
{ 0x55, 20670,  525018, "3592A5 (unencrypted)" },
+   { 0x56, 20670,  525018, "3592B5 (unencrypted)" },
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
@@ -650,6 +651,7 @@ static struct densities {
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },
{ 0x74, 19686,  500024, "3592A4 (encrypted)" },
{ 0x75, 20670,  525018, "3592A5 (encrypted)" },
+   { 0x76, 20670,  525018, "3592B5 (encrypted)" },
{ 0x8c,  1789,   45434, "EXB-8500c" },
{ 0x90,  1703,   43245, "EXB-8200c" },
{ 0, 0, 0, NULL }

Modified: head/usr.bin/mt/mt.1
==
--- head/usr.bin/mt/mt.1Fri Jul 14 16:05:54 2017(r320990)
+++ head/usr.bin/mt/mt.1Fri Jul 14 16:45:46 2017(r320991)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd May 11, 2017
+.Dd July 14, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -518,6 +518,7 @@ Value  WidthTracksDensity Code Typ
 0x53   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (unencrypted)
 0x54   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (unencrypted)
 0x55   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (unencrypted)
+0x56   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (unencrypted)
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
@@ -527,6 +528,7 @@ Value  WidthTracksDensity Code Typ
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
 0x74   12.7  (0.5) 2560  19,686 (500,024)   C   3592A4 (encrypted)
 0x75   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (encrypted)
+0x76   12.7  (0.5) 7680  20,670 (525,018)   C   3592B5 (encrypted)
 0x8c8.0  (0.315)  1  1,789  (45,434)  RLL   CS  EXB-8500c5,9
 0x908.0  (0.315)  1  1,703  (43,245)  RLL   CS  EXB-8200c5,9
 .Ed
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r320608 - releng/11.1/sys/cam

2017-07-03 Thread Kenneth D. Merry
Author: ken
Date: Mon Jul  3 18:20:45 2017
New Revision: 320608
URL: https://svnweb.freebsd.org/changeset/base/320608

Log:
  Merge r320602 from stable/11 into releng/11.1:

r320602 | ken | 2017-07-03 09:34:21 -0600 (Mon, 03 Jul 2017) | 45 lines
  
MFC r320421:
  
  
  r320421 | ken | 2017-06-27 13:26:02 -0600 (Tue, 27 Jun 2017) | 37 lines
  
  Fix a panic in camperiphfree().
  
  If a peripheral driver (e.g. da, sa, cd) is added or removed from the
  peripheral driver list while an unrelated peripheral driver instance (e.g.
  da0, sa5, cd2) is going away and is inside camperiphfree(), we could
  dereference an invalid pointer.
  
  When peripheral drivers are added or removed (see periphdriver_register()
  and periphdriver_unregister()), the peripheral driver array is resized
  and existing entries are moved.
  
  Although we hold the topology lock while we traverse the peripheral driver
  list, we retain a pointer to the location of the peripheral driver pointer
  and then drop the topology lock.  So we are still vulnerable to the list
  getting moved around while the lock is dropped.
  
  To solve the problem, cache a copy of the peripheral driver pointer.  If
  its storage location in the list changes while we have the lock dropped, 
it
  won't have any effect.
  
  This doesn't solve the issue that peripheral drivers ("da", "cd", as 
opposed
  to individual instances like "da0", "cd0") are not generally part of a
  reference counting scheme to guard against deregistering them while there
  are instances active.  The caller (generally the person unloading a 
module)
  has to be aware of active drivers and not unload something that is in use.
  
  sys/cam/cam_periph.c:
In camperiphfree(), cache a pointer to the peripheral driver
instance to avoid holding a pointer to an invalid memory location
in the event that the peripheral driver list changes while we have
the topology lock dropped.
  
  PR:   kern/219701
  Submitted by: avg
  Sponsored by: Spectra Logic
  
  

  
  Approved by:  re (gjb)

Modified:
  releng/11.1/sys/cam/cam_periph.c
Directory Properties:
  releng/11.1/   (props changed)

Modified: releng/11.1/sys/cam/cam_periph.c
==
--- releng/11.1/sys/cam/cam_periph.cMon Jul  3 18:07:09 2017
(r320607)
+++ releng/11.1/sys/cam/cam_periph.cMon Jul  3 18:20:45 2017
(r320608)
@@ -654,6 +654,7 @@ static void
 camperiphfree(struct cam_periph *periph)
 {
struct periph_driver **p_drv;
+   struct periph_driver *drv;
 
cam_periph_assert(periph, MA_OWNED);
KASSERT(periph->periph_allocating == 0, ("%s%d: freed while allocating",
@@ -666,6 +667,15 @@ camperiphfree(struct cam_periph *periph)
printf("camperiphfree: attempt to free non-existant periph\n");
return;
}
+   /*
+* Cache a pointer to the periph_driver structure.  If a
+* periph_driver is added or removed from the array (see
+* periphdriver_register()) while we drop the toplogy lock
+* below, p_drv may change.  This doesn't protect against this
+* particular periph_driver going away.  That will require full
+* reference counting in the periph_driver infrastructure.
+*/
+   drv = *p_drv;
 
/*
 * We need to set this flag before dropping the topology lock, to
@@ -701,8 +711,8 @@ camperiphfree(struct cam_periph *periph)
 */
xpt_lock_buses();
 
-   TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links);
-   (*p_drv)->generation++;
+   TAILQ_REMOVE(>units, periph, unit_links);
+   drv->generation++;
 
xpt_remove_periph(periph);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r320607 - releng/11.1/sys/cam/scsi

2017-07-03 Thread Kenneth D. Merry
Author: ken
Date: Mon Jul  3 18:07:09 2017
New Revision: 320607
URL: https://svnweb.freebsd.org/changeset/base/320607

Log:
  Merge r320600 from stable/11 into releng/11.1:

r320600 | ken | 2017-07-03 09:10:16 -0600 (Mon, 03 Jul 2017) | 30 lines
  
MFC r320420:
  
  
  r320420 | ken | 2017-06-27 11:55:25 -0600 (Tue, 27 Jun 2017) | 25 lines
  
  In scsi_zbc_in(), fill in the length in the ZBC IN CDB.
  
  Without the allocation length set, the target will either reject
  the command or complete it without transferring any data.
  
  This fixes the REPORT ZONES command for SCSI ZBC protocol devices,
  as well as ATA ZAC protocol devices that are behind a SCSI to ATA
  translation layer.  (LSI/Broadcom's 12Gb SAS adapters translate ZBC
  commands to ZAC commands.)  Those are Host Aware and Host Managed SMR
  drives.
  
  This will fix REPORT ZONE commands sent to the da(4) driver via the
  GEOM bio interface and zonectl, and REPORT ZONE commands sent from
  camcontrol(8).
  
  Note that in the case of camcontrol(8), we currently only send
  SCSI ZBC commands to native SCSI protocol devices, not ATA devices
  behind a SAT layer.
  
  sys/cam/scsi/scsi_da.c:
Fill in the length field in scsi_zbc_in().
  
  Sponsored by: Spectra Logic
  

  
  Approved by:  re (gjb)

Modified:
  releng/11.1/sys/cam/scsi/scsi_da.c
Directory Properties:
  releng/11.1/   (props changed)

Modified: releng/11.1/sys/cam/scsi/scsi_da.c
==
--- releng/11.1/sys/cam/scsi/scsi_da.c  Mon Jul  3 18:01:58 2017
(r320606)
+++ releng/11.1/sys/cam/scsi/scsi_da.c  Mon Jul  3 18:07:09 2017
(r320607)
@@ -5748,6 +5748,7 @@ scsi_zbc_in(struct ccb_scsiio *csio, uint32_t retries,
scsi_cmd = (struct scsi_zbc_in *)>cdb_io.cdb_bytes;
scsi_cmd->opcode = ZBC_IN;
scsi_cmd->service_action = service_action;
+   scsi_ulto4b(dxfer_len, scsi_cmd->length);
scsi_u64to8b(zone_start_lba, scsi_cmd->zone_start_lba);
scsi_cmd->zone_options = zone_options;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r320601 - stable/10/sys/cam

2017-07-03 Thread Kenneth D. Merry
Author: ken
Date: Mon Jul  3 15:34:19 2017
New Revision: 320601
URL: https://svnweb.freebsd.org/changeset/base/320601

Log:
  MFC r320421:
  

r320421 | ken | 2017-06-27 13:26:02 -0600 (Tue, 27 Jun 2017) | 37 lines
  
Fix a panic in camperiphfree().
  
If a peripheral driver (e.g. da, sa, cd) is added or removed from the
peripheral driver list while an unrelated peripheral driver instance (e.g.
da0, sa5, cd2) is going away and is inside camperiphfree(), we could
dereference an invalid pointer.
  
When peripheral drivers are added or removed (see periphdriver_register()
and periphdriver_unregister()), the peripheral driver array is resized
and existing entries are moved.
  
Although we hold the topology lock while we traverse the peripheral driver
list, we retain a pointer to the location of the peripheral driver pointer
and then drop the topology lock.  So we are still vulnerable to the list
getting moved around while the lock is dropped.
  
To solve the problem, cache a copy of the peripheral driver pointer.  If
its storage location in the list changes while we have the lock dropped, it
won't have any effect.
  
This doesn't solve the issue that peripheral drivers ("da", "cd", as opposed
to individual instances like "da0", "cd0") are not generally part of a
reference counting scheme to guard against deregistering them while there
are instances active.  The caller (generally the person unloading a module)
has to be aware of active drivers and not unload something that is in use.
  
sys/cam/cam_periph.c:
In camperiphfree(), cache a pointer to the peripheral driver
instance to avoid holding a pointer to an invalid memory location
in the event that the peripheral driver list changes while we have
the topology lock dropped.
  
PR: kern/219701
Submitted by:   avg
Sponsored by:   Spectra Logic
  

  PR:   kern/219701
  Sponsored by: Spectra Logic

Modified:
  stable/10/sys/cam/cam_periph.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/cam_periph.c
==
--- stable/10/sys/cam/cam_periph.c  Mon Jul  3 15:10:16 2017
(r320600)
+++ stable/10/sys/cam/cam_periph.c  Mon Jul  3 15:34:19 2017
(r320601)
@@ -622,6 +622,7 @@ static void
 camperiphfree(struct cam_periph *periph)
 {
struct periph_driver **p_drv;
+   struct periph_driver *drv;
 
cam_periph_assert(periph, MA_OWNED);
KASSERT(periph->periph_allocating == 0, ("%s%d: freed while allocating",
@@ -634,6 +635,15 @@ camperiphfree(struct cam_periph *periph)
printf("camperiphfree: attempt to free non-existant periph\n");
return;
}
+   /*
+* Cache a pointer to the periph_driver structure.  If a
+* periph_driver is added or removed from the array (see
+* periphdriver_register()) while we drop the toplogy lock
+* below, p_drv may change.  This doesn't protect against this
+* particular periph_driver going away.  That will require full
+* reference counting in the periph_driver infrastructure.
+*/
+   drv = *p_drv;
 
/*
 * We need to set this flag before dropping the topology lock, to
@@ -669,8 +679,8 @@ camperiphfree(struct cam_periph *periph)
 */
xpt_lock_buses();
 
-   TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links);
-   (*p_drv)->generation++;
+   TAILQ_REMOVE(>units, periph, unit_links);
+   drv->generation++;
 
xpt_remove_periph(periph);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r320602 - stable/11/sys/cam

2017-07-03 Thread Kenneth D. Merry
Author: ken
Date: Mon Jul  3 15:34:21 2017
New Revision: 320602
URL: https://svnweb.freebsd.org/changeset/base/320602

Log:
  MFC r320421:
  

r320421 | ken | 2017-06-27 13:26:02 -0600 (Tue, 27 Jun 2017) | 37 lines
  
Fix a panic in camperiphfree().
  
If a peripheral driver (e.g. da, sa, cd) is added or removed from the
peripheral driver list while an unrelated peripheral driver instance (e.g.
da0, sa5, cd2) is going away and is inside camperiphfree(), we could
dereference an invalid pointer.
  
When peripheral drivers are added or removed (see periphdriver_register()
and periphdriver_unregister()), the peripheral driver array is resized
and existing entries are moved.
  
Although we hold the topology lock while we traverse the peripheral driver
list, we retain a pointer to the location of the peripheral driver pointer
and then drop the topology lock.  So we are still vulnerable to the list
getting moved around while the lock is dropped.
  
To solve the problem, cache a copy of the peripheral driver pointer.  If
its storage location in the list changes while we have the lock dropped, it
won't have any effect.
  
This doesn't solve the issue that peripheral drivers ("da", "cd", as opposed
to individual instances like "da0", "cd0") are not generally part of a
reference counting scheme to guard against deregistering them while there
are instances active.  The caller (generally the person unloading a module)
has to be aware of active drivers and not unload something that is in use.
  
sys/cam/cam_periph.c:
In camperiphfree(), cache a pointer to the peripheral driver
instance to avoid holding a pointer to an invalid memory location
in the event that the peripheral driver list changes while we have
the topology lock dropped.
  
PR: kern/219701
Submitted by:   avg
Sponsored by:   Spectra Logic
  

  PR:   kern/219701
  Sponsored by: Spectra Logic

Modified:
  stable/11/sys/cam/cam_periph.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/cam_periph.c
==
--- stable/11/sys/cam/cam_periph.c  Mon Jul  3 15:34:19 2017
(r320601)
+++ stable/11/sys/cam/cam_periph.c  Mon Jul  3 15:34:21 2017
(r320602)
@@ -654,6 +654,7 @@ static void
 camperiphfree(struct cam_periph *periph)
 {
struct periph_driver **p_drv;
+   struct periph_driver *drv;
 
cam_periph_assert(periph, MA_OWNED);
KASSERT(periph->periph_allocating == 0, ("%s%d: freed while allocating",
@@ -666,6 +667,15 @@ camperiphfree(struct cam_periph *periph)
printf("camperiphfree: attempt to free non-existant periph\n");
return;
}
+   /*
+* Cache a pointer to the periph_driver structure.  If a
+* periph_driver is added or removed from the array (see
+* periphdriver_register()) while we drop the toplogy lock
+* below, p_drv may change.  This doesn't protect against this
+* particular periph_driver going away.  That will require full
+* reference counting in the periph_driver infrastructure.
+*/
+   drv = *p_drv;
 
/*
 * We need to set this flag before dropping the topology lock, to
@@ -701,8 +711,8 @@ camperiphfree(struct cam_periph *periph)
 */
xpt_lock_buses();
 
-   TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links);
-   (*p_drv)->generation++;
+   TAILQ_REMOVE(>units, periph, unit_links);
+   drv->generation++;
 
xpt_remove_periph(periph);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r320600 - stable/11/sys/cam/scsi

2017-07-03 Thread Kenneth D. Merry
Author: ken
Date: Mon Jul  3 15:10:16 2017
New Revision: 320600
URL: https://svnweb.freebsd.org/changeset/base/320600

Log:
  MFC r320420:
  

r320420 | ken | 2017-06-27 11:55:25 -0600 (Tue, 27 Jun 2017) | 25 lines
  
In scsi_zbc_in(), fill in the length in the ZBC IN CDB.
  
Without the allocation length set, the target will either reject
the command or complete it without transferring any data.
  
This fixes the REPORT ZONES command for SCSI ZBC protocol devices,
as well as ATA ZAC protocol devices that are behind a SCSI to ATA
translation layer.  (LSI/Broadcom's 12Gb SAS adapters translate ZBC
commands to ZAC commands.)  Those are Host Aware and Host Managed SMR
drives.
  
This will fix REPORT ZONE commands sent to the da(4) driver via the
GEOM bio interface and zonectl, and REPORT ZONE commands sent from
camcontrol(8).
  
Note that in the case of camcontrol(8), we currently only send
SCSI ZBC commands to native SCSI protocol devices, not ATA devices
behind a SAT layer.
  
sys/cam/scsi/scsi_da.c:
Fill in the length field in scsi_zbc_in().
  
Sponsored by:   Spectra Logic


Modified:
  stable/11/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_da.c
==
--- stable/11/sys/cam/scsi/scsi_da.cMon Jul  3 14:31:38 2017
(r320599)
+++ stable/11/sys/cam/scsi/scsi_da.cMon Jul  3 15:10:16 2017
(r320600)
@@ -5748,6 +5748,7 @@ scsi_zbc_in(struct ccb_scsiio *csio, uint32_t retries,
scsi_cmd = (struct scsi_zbc_in *)>cdb_io.cdb_bytes;
scsi_cmd->opcode = ZBC_IN;
scsi_cmd->service_action = service_action;
+   scsi_ulto4b(dxfer_len, scsi_cmd->length);
scsi_u64to8b(zone_start_lba, scsi_cmd->zone_start_lba);
scsi_cmd->zone_options = zone_options;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r320421 - head/sys/cam

2017-06-27 Thread Kenneth D. Merry
Author: ken
Date: Tue Jun 27 19:26:02 2017
New Revision: 320421
URL: https://svnweb.freebsd.org/changeset/base/320421

Log:
  Fix a panic in camperiphfree().
  
  If a peripheral driver (e.g. da, sa, cd) is added or removed from the
  peripheral driver list while an unrelated peripheral driver instance (e.g.
  da0, sa5, cd2) is going away and is inside camperiphfree(), we could
  dereference an invalid pointer.
  
  When peripheral drivers are added or removed (see periphdriver_register()
  and periphdriver_unregister()), the peripheral driver array is resized
  and existing entries are moved.
  
  Although we hold the topology lock while we traverse the peripheral driver
  list, we retain a pointer to the location of the peripheral driver pointer
  and then drop the topology lock.  So we are still vulnerable to the list
  getting moved around while the lock is dropped.
  
  To solve the problem, cache a copy of the peripheral driver pointer.  If
  its storage location in the list changes while we have the lock dropped, it
  won't have any effect.
  
  This doesn't solve the issue that peripheral drivers ("da", "cd", as opposed
  to individual instances like "da0", "cd0") are not generally part of a
  reference counting scheme to guard against deregistering them while there
  are instances active.  The caller (generally the person unloading a module)
  has to be aware of active drivers and not unload something that is in use.
  
  sys/cam/cam_periph.c:
In camperiphfree(), cache a pointer to the peripheral driver
instance to avoid holding a pointer to an invalid memory location
in the event that the peripheral driver list changes while we have
the topology lock dropped.
  
  PR:   kern/219701
  Submitted by: avg
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Tue Jun 27 17:55:25 2017(r320420)
+++ head/sys/cam/cam_periph.c   Tue Jun 27 19:26:02 2017(r320421)
@@ -661,6 +661,7 @@ static void
 camperiphfree(struct cam_periph *periph)
 {
struct periph_driver **p_drv;
+   struct periph_driver *drv;
 
cam_periph_assert(periph, MA_OWNED);
KASSERT(periph->periph_allocating == 0, ("%s%d: freed while allocating",
@@ -673,6 +674,15 @@ camperiphfree(struct cam_periph *periph)
printf("camperiphfree: attempt to free non-existant periph\n");
return;
}
+   /*
+* Cache a pointer to the periph_driver structure.  If a
+* periph_driver is added or removed from the array (see
+* periphdriver_register()) while we drop the toplogy lock
+* below, p_drv may change.  This doesn't protect against this
+* particular periph_driver going away.  That will require full
+* reference counting in the periph_driver infrastructure.
+*/
+   drv = *p_drv;
 
/*
 * We need to set this flag before dropping the topology lock, to
@@ -708,8 +718,8 @@ camperiphfree(struct cam_periph *periph)
 */
xpt_lock_buses();
 
-   TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links);
-   (*p_drv)->generation++;
+   TAILQ_REMOVE(>units, periph, unit_links);
+   drv->generation++;
 
xpt_remove_periph(periph);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r320420 - head/sys/cam/scsi

2017-06-27 Thread Kenneth D. Merry
Author: ken
Date: Tue Jun 27 17:55:25 2017
New Revision: 320420
URL: https://svnweb.freebsd.org/changeset/base/320420

Log:
  In scsi_zbc_in(), fill in the length in the ZBC IN CDB.
  
  Without the allocation length set, the target will either reject
  the command or complete it without transferring any data.
  
  This fixes the REPORT ZONES command for SCSI ZBC protocol devices,
  as well as ATA ZAC protocol devices that are behind a SCSI to ATA
  translation layer.  (LSI/Broadcom's 12Gb SAS adapters translate ZBC
  commands to ZAC commands.)  Those are Host Aware and Host Managed SMR
  drives.
  
  This will fix REPORT ZONE commands sent to the da(4) driver via the
  GEOM bio interface and zonectl, and REPORT ZONE commands sent from
  camcontrol(8).
  
  Note that in the case of camcontrol(8), we currently only send
  SCSI ZBC commands to native SCSI protocol devices, not ATA devices
  behind a SAT layer.
  
  sys/cam/scsi/scsi_da.c:
Fill in the length field in scsi_zbc_in().
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Tue Jun 27 17:48:11 2017(r320419)
+++ head/sys/cam/scsi/scsi_da.c Tue Jun 27 17:55:25 2017(r320420)
@@ -5804,6 +5804,7 @@ scsi_zbc_in(struct ccb_scsiio *csio, uint32_t retries,
scsi_cmd = (struct scsi_zbc_in *)>cdb_io.cdb_bytes;
scsi_cmd->opcode = ZBC_IN;
scsi_cmd->service_action = service_action;
+   scsi_ulto4b(dxfer_len, scsi_cmd->length);
scsi_u64to8b(zone_start_lba, scsi_cmd->zone_start_lba);
scsi_cmd->zone_options = zone_options;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r320405 - stable/11/sys/cam/scsi

2017-06-27 Thread Kenneth D. Merry
Author: ken
Date: Tue Jun 27 12:56:36 2017
New Revision: 320405
URL: https://svnweb.freebsd.org/changeset/base/320405

Log:
  MFC r320123:
  
Fix a potential sleep while holding a mutex in the sa(4) driver.
  
If the user issues a MTIOCEXTGET ioctl, and the tape drive in question has
a serial number that is longer than 80 characters, we malloc a buffer in
saextget() to hold the output of cam_strvis().
  
Since a mutex is held in that codepath, doing a M_WAITOK malloc could lead
to sleeping while holding a mutex.  Change it to a M_NOWAIT malloc and bail
out if we fail to allocate the memory.  Devices with serial numbers longer
than 80 bytes are very rare (I don't recall seeing one), so this
should be a very unusual case to hit.  But it is a bug that should be fixed.
  
sys/cam/scsi/scsi_sa.c:
In saextget(), if we need to malloc a buffer to hold the output of
cam_strvis(), don't wait for the memory.  Fail and return an error
if we can't allocate the memory immediately.
  
  PR:   kern/220094
  Submitted by: Jia-Ju Bai 
  Sponsored by: Spectra Logic
  Approved by:  re (gjb)

Modified:
  stable/11/sys/cam/scsi/scsi_sa.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_sa.c
==
--- stable/11/sys/cam/scsi/scsi_sa.cTue Jun 27 10:50:48 2017
(r320404)
+++ stable/11/sys/cam/scsi/scsi_sa.cTue Jun 27 12:56:36 2017
(r320405)
@@ -4465,7 +4465,18 @@ saextget(struct cdev *dev, struct cam_periph *periph, 
if (cgd.serial_num_len > sizeof(tmpstr)) {
ts2_len = cgd.serial_num_len + 1;
ts2_malloc = 1;
-   tmpstr2 = malloc(ts2_len, M_SCSISA, M_WAITOK | M_ZERO);
+   tmpstr2 = malloc(ts2_len, M_SCSISA, M_NOWAIT | M_ZERO);
+   /*
+* The 80 characters allocated on the stack above
+* will handle the vast majority of serial numbers.
+* If we run into one that is larger than that, and
+* we can't malloc the length without blocking,
+* bail out with an out of memory error.
+*/
+   if (tmpstr2 == NULL) {
+   error = ENOMEM;
+   goto extget_bailout;
+   }
} else {
ts2_len = sizeof(tmpstr);
ts2_malloc = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r320361 - stable/10/sys/cam/scsi

2017-06-26 Thread Kenneth D. Merry
Author: ken
Date: Mon Jun 26 15:23:12 2017
New Revision: 320361
URL: https://svnweb.freebsd.org/changeset/base/320361

Log:
  MFC r320123:
  
Fix a potential sleep while holding a mutex in the sa(4) driver.
  
If the user issues a MTIOCEXTGET ioctl, and the tape drive in question has
a serial number that is longer than 80 characters, we malloc a buffer in
saextget() to hold the output of cam_strvis().
  
Since a mutex is held in that codepath, doing a M_WAITOK malloc could lead
to sleeping while holding a mutex.  Change it to a M_NOWAIT malloc and bail
out if we fail to allocate the memory.  Devices with serial numbers longer
than 80 bytes are very rare (I don't recall seeing one), so this
should be a very unusual case to hit.  But it is a bug that should be fixed.
  
sys/cam/scsi/scsi_sa.c:
In saextget(), if we need to malloc a buffer to hold the output of
cam_strvis(), don't wait for the memory.  Fail and return an error
if we can't allocate the memory immediately.
  
  PR:   kern/220094
  Submitted by: Jia-Ju Bai 
  Sponsored by: Spectra Logic

Modified:
  stable/10/sys/cam/scsi/scsi_sa.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_sa.c
==
--- stable/10/sys/cam/scsi/scsi_sa.cMon Jun 26 13:14:41 2017
(r320360)
+++ stable/10/sys/cam/scsi/scsi_sa.cMon Jun 26 15:23:12 2017
(r320361)
@@ -4464,7 +4464,18 @@ saextget(struct cdev *dev, struct cam_periph *periph, 
if (cgd.serial_num_len > sizeof(tmpstr)) {
ts2_len = cgd.serial_num_len + 1;
ts2_malloc = 1;
-   tmpstr2 = malloc(ts2_len, M_SCSISA, M_WAITOK | M_ZERO);
+   tmpstr2 = malloc(ts2_len, M_SCSISA, M_NOWAIT | M_ZERO);
+   /*
+* The 80 characters allocated on the stack above
+* will handle the vast majority of serial numbers.
+* If we run into one that is larger than that, and
+* we can't malloc the length without blocking,
+* bail out with an out of memory error.
+*/
+   if (tmpstr2 == NULL) {
+   error = ENOMEM;
+   goto extget_bailout;
+   }
} else {
ts2_len = sizeof(tmpstr);
ts2_malloc = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r320156 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contr

2017-06-21 Thread Kenneth D. Merry
On Wed, Jun 21, 2017 at 11:16:23 +0300, Andriy Gapon wrote:
> On 21/06/2017 00:25, Kenneth D. Merry wrote:
> > FWIW, avg sent me a patch for this particular problem (by checking for NULL
> > before dereferencing the pointer), and although it got me past the above
> > problem, I hit another related panic:
> 
> Could you please re-enable ZFS TRIM support and test r320186 or later?
> Thank you for all your help with the testing and debugging.

That fixed it, thank you!

Ken
-- 
Kenneth Merry
k...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r320156 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contr

2017-06-20 Thread Kenneth D. Merry
On Tue, Jun 20, 2017 at 23:37:10 +0300, Andriy Gapon wrote:
> On 20/06/2017 23:29, Ken Merry wrote:
> > I don???t know for sure that this commit is the cause, but it (and r320153) 
> > are the only ZFS commits between a version of head from June 14th that 
> > boots off a ZFS mirror, and one that panics.
> > 
> > Here???s the stack trace:
> > 
> > Fatal trap 12: page fault while in kernel mode
> > cpuid = 22; 
> > 
> > Fatal trap 12: page fault while in kernel mode
> > cpuid = 9; apic id = 09
> > fault virtual address   = 0x0
> > fault code  = supervisor read data, page not present
> > instruction pointer = 0x20:0x81e47f21
> > stack pointer   = 0x28:0xfe08b37f8810
> > frame pointer   = 0x28:0xfe08b37f8860
> > code segment= base 0x0, limit 0xf, type 0x1b
> > = DPL 0, pres 1, long 1, def32 0, gran 1
> > processor eflags= interrupt enabled, resume, IOPL = 0
> > current process = 0 (zio_free_issue_0_3)
> > [ thread pid 0 tid 100478 ]
> > Stopped at  0x81e47f21 = zio_vdev_io_start+0x1f1:   testb   
> > $0x1,(%rax)
> > db> bt
> > Tracing pid 0 tid 100478 td 0xf80193156000
> > zio_vdev_io_start() at 0x81e47f21 = zio_vdev_io_start+0x1f1/frame 
> > 0xfe08b37f8860
> > zio_execute() at 0x81e4312c = zio_execute+0x36c/frame 
> > 0xfe08b37f88b0
> > zio_nowait() at 0x81e422b8 = zio_nowait+0xb8/frame 
> > 0xfe08b37f88e0
> > vdev_mirror_io_start() at 0x81e224fc = 
> > vdev_mirror_io_start+0x38c/frame 0xfe08b37f8930
> > zio_vdev_io_start() at 0x81e48030 = zio_vdev_io_start+0x300/frame 
> > 0xfe08b37f8990
> > zio_execute() at 0x81e4312c = zio_execute+0x36c/frame 
> > 0xfe08b37f89e0
> > taskqueue_run_locked() at 0x809a9d6d = 
> > taskqueue_run_locked+0x13d/frame 0xfe08b37f8a40
> > taskqueue_thread_loop() at 0x809aab28 = 
> > taskqueue_thread_loop+0x88/frame 0xfe08b37f8a70
> > fork_exit() at 0x8091e3e4 = fork_exit+0x84/frame 0xfe08b37f8ab0
> > fork_trampoline() at 0x80d930fe = fork_trampoline+0xe/frame 
> > 0xfe08b37f8ab0
> > --- trap 0, rip = 0, rsp = 0, rbp = 0 ---
> > db> 
> > 
> > (kgdb) list *(zio_vdev_io_start+0x1f1)
> > 0xd9f21 is in zio_vdev_io_start 
> > (/usr/home/kenm/perforce4/kenm/FreeBSD-test/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c:350).
> > 345
> > 346 /*
> > 347  * Ensure that anyone expecting this zio to contain a 
> > linear ABD isn't
> > 348  * going to get a nasty surprise when they try to access 
> > the data.
> > 349  */
> > 350 IMPLY(abd_is_linear(zio->io_abd), abd_is_linear(data));
> > 351
> > 352 zt->zt_orig_abd = zio->io_abd;
> > 353 zt->zt_orig_size = zio->io_size;
> > 354 zt->zt_bufsize = bufsize;
> > 
> > I???ll try rebooting and see if the problem goes away.  If not, I???ll roll 
> > back the ABD change and see if the problem goes away.
> 
> Judging from the thread that panic-ed the problem may have to do with our TRIM
> support.  Unfortunately,  I didn't have a chance to test the change on a 
> system
> with working TRIM and, so, I missed it.
> I will look into this further, but it's almost obvious that the problem is
> caused by zio->io_abd being NULL for a zio of type ZIO_TYPE_FREE.

FWIW, avg sent me a patch for this particular problem (by checking for NULL
before dereferencing the pointer), and although it got me past the above
problem, I hit another related panic:

Fatal trap 12: page fault while in kernel mode
cpuid = 6; 

Fatal trap 12: page fault while in kernel mode
cpuid = 14; apic id = 22
fault virtual address   = 0x4
fault code  = supervisor read data, page not present
instruction pointer = 0x20:0x81d92a2d
stack pointer   = 0x0:0xfe08b36e0710
frame pointer   = 0x0:0xfe08b36e0730
code segment= base 0x0, limit 0xf, type 0x1b


Fatal trap 12: page fault while in kernel mode
cpuid = 11; apic id = 0b
fault virtual address   = 0x4
Fatal trap 12: page fault while in kernel mode
cpuid = 8; apic id = 08
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags= interrupt enabled, resume, IOPL = 0
current process = 0 (zio_free_issue_4_1)
[ thread pid 0 tid 100799 ]
Stopped at  0x81d92a2d = abd_verify+0xd:movl0x4(%r14),%eax
db> bt
Tracing pid 0 tid 100799 td 0xf801931b8560
abd_verify() at 0x81d92a2d = abd_verify+0xd/frame 0xfe08b36e0730
abd_put() at 0x81d92eff = abd_put+0xf/frame 0xfe08b36e0750
vdev_raidz_map_free() at 0x81e26312 = vdev_raidz_map_free+0x82/frame 
0xfe08b36e0780
zio_vdev_io_assess() at 0x81e48646 = zio_vdev_io_assess+0x116/frame 
0xfe08b36e07b0
zio_execute() at 0x81e4312c = zio_execute+0x36c/frame 0xfe08b36e0800
zio_vdev_io_start() at 

svn commit: r320123 - head/sys/cam/scsi

2017-06-19 Thread Kenneth D. Merry
Author: ken
Date: Mon Jun 19 20:48:00 2017
New Revision: 320123
URL: https://svnweb.freebsd.org/changeset/base/320123

Log:
  Fix a potential sleep while holding a mutex in the sa(4) driver.
  
  If the user issues a MTIOCEXTGET ioctl, and the tape drive in question has
  a serial number that is longer than 80 characters, we malloc a buffer in
  saextget() to hold the output of cam_strvis().
  
  Since a mutex is held in that codepath, doing a M_WAITOK malloc could lead
  to sleeping while holding a mutex.  Change it to a M_NOWAIT malloc and bail
  out if we fail to allocate the memory.  Devices with serial numbers longer
  than 80 bytes are very rare (I don't recall seeing one), so this
  should be a very unusual case to hit.  But it is a bug that should be fixed.
  
  sys/cam/scsi/scsi_sa.c:
In saextget(), if we need to malloc a buffer to hold the output of
cam_strvis(), don't wait for the memory.  Fail and return an error
if we can't allocate the memory immediately.
  
  PR:   kern/220094
  Submitted by: Jia-Ju Bai 
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/scsi/scsi_sa.c

Modified: head/sys/cam/scsi/scsi_sa.c
==
--- head/sys/cam/scsi/scsi_sa.c Mon Jun 19 20:47:24 2017(r320122)
+++ head/sys/cam/scsi/scsi_sa.c Mon Jun 19 20:48:00 2017(r320123)
@@ -4465,7 +4465,18 @@ saextget(struct cdev *dev, struct cam_periph *periph, 
if (cgd.serial_num_len > sizeof(tmpstr)) {
ts2_len = cgd.serial_num_len + 1;
ts2_malloc = 1;
-   tmpstr2 = malloc(ts2_len, M_SCSISA, M_WAITOK | M_ZERO);
+   tmpstr2 = malloc(ts2_len, M_SCSISA, M_NOWAIT | M_ZERO);
+   /*
+* The 80 characters allocated on the stack above
+* will handle the vast majority of serial numbers.
+* If we run into one that is larger than that, and
+* we can't malloc the length without blocking,
+* bail out with an out of memory error.
+*/
+   if (tmpstr2 == NULL) {
+   error = ENOMEM;
+   goto extget_bailout;
+   }
} else {
ts2_len = sizeof(tmpstr);
ts2_malloc = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318295 - in stable/10: lib/libmt usr.bin/mt

2017-05-15 Thread Kenneth D. Merry
Author: ken
Date: Mon May 15 15:27:59 2017
New Revision: 318295
URL: https://svnweb.freebsd.org/changeset/base/318295

Log:
  MFC r318185:
  
Add LTO-8 density codes.
  
lib/libmt/mtlib.c:
Add the LTO-8 density code to the density table in libmt.
  
usr.bin/mt/mt.1:
Add the LTO-8 density code, tracks, bpmm, and bpi to the density
table in the mt(1) man page.
  
  Sponsored by: Spectra Logic

Modified:
  stable/10/lib/libmt/mtlib.c
  stable/10/usr.bin/mt/mt.1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libmt/mtlib.c
==
--- stable/10/lib/libmt/mtlib.c Mon May 15 15:18:36 2017(r318294)
+++ stable/10/lib/libmt/mtlib.c Mon May 15 15:27:59 2017(r318295)
@@ -644,6 +644,7 @@ static struct densities {
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
+   { 0x5E, 20669,  524993, "LTO-8" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },

Modified: stable/10/usr.bin/mt/mt.1
==
--- stable/10/usr.bin/mt/mt.1   Mon May 15 15:18:36 2017(r318294)
+++ stable/10/usr.bin/mt/mt.1   Mon May 15 15:27:59 2017(r318295)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2017
+.Dd May 11, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -521,6 +521,7 @@ Value  WidthTracksDensity   
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
+0x5E   12.7  (0.5) 6656  20,669 (524,993)   C   LTO-8
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318296 - in stable/11: lib/libmt usr.bin/mt

2017-05-15 Thread Kenneth D. Merry
Author: ken
Date: Mon May 15 15:28:01 2017
New Revision: 318296
URL: https://svnweb.freebsd.org/changeset/base/318296

Log:
  MFC r318185:
  
Add LTO-8 density codes.
  
lib/libmt/mtlib.c:
Add the LTO-8 density code to the density table in libmt.
  
usr.bin/mt/mt.1:
Add the LTO-8 density code, tracks, bpmm, and bpi to the density
table in the mt(1) man page.
  
  Sponsored by: Spectra Logic

Modified:
  stable/11/lib/libmt/mtlib.c
  stable/11/usr.bin/mt/mt.1
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libmt/mtlib.c
==
--- stable/11/lib/libmt/mtlib.c Mon May 15 15:27:59 2017(r318295)
+++ stable/11/lib/libmt/mtlib.c Mon May 15 15:28:01 2017(r318296)
@@ -644,6 +644,7 @@ static struct densities {
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
+   { 0x5E, 20669,  524993, "LTO-8" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },

Modified: stable/11/usr.bin/mt/mt.1
==
--- stable/11/usr.bin/mt/mt.1   Mon May 15 15:27:59 2017(r318295)
+++ stable/11/usr.bin/mt/mt.1   Mon May 15 15:28:01 2017(r318296)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2017
+.Dd May 11, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -521,6 +521,7 @@ Value  WidthTracksDensity   
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
+0x5E   12.7  (0.5) 6656  20,669 (524,993)   C   LTO-8
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318185 - in head: lib/libmt usr.bin/mt

2017-05-11 Thread Kenneth D. Merry
Author: ken
Date: Thu May 11 13:46:30 2017
New Revision: 318185
URL: https://svnweb.freebsd.org/changeset/base/318185

Log:
  Add LTO-8 density codes.
  
  lib/libmt/mtlib.c:
Add the LTO-8 density code to the density table in libmt.
  
  usr.bin/mt/mt.1:
Add the LTO-8 density code, tracks, bpmm, and bpi to the density
table in the mt(1) man page.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/lib/libmt/mtlib.c
  head/usr.bin/mt/mt.1

Modified: head/lib/libmt/mtlib.c
==
--- head/lib/libmt/mtlib.c  Thu May 11 11:13:02 2017(r318184)
+++ head/lib/libmt/mtlib.c  Thu May 11 13:46:30 2017(r318185)
@@ -644,6 +644,7 @@ static struct densities {
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
+   { 0x5E, 20669,  524993, "LTO-8" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },

Modified: head/usr.bin/mt/mt.1
==
--- head/usr.bin/mt/mt.1Thu May 11 11:13:02 2017(r318184)
+++ head/usr.bin/mt/mt.1Thu May 11 13:46:30 2017(r318185)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2017
+.Dd May 11, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -521,6 +521,7 @@ Value  WidthTracksDensity   
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
+0x5E   12.7  (0.5) 6656  20,669 (524,993)   C   LTO-8
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318149 - stable/10/sys/dev/isp

2017-05-10 Thread Kenneth D. Merry
Author: ken
Date: Wed May 10 18:59:20 2017
New Revision: 318149
URL: https://svnweb.freebsd.org/changeset/base/318149

Log:
  MFC r317740:
  
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

Modified:
  stable/10/sys/dev/isp/isp.c
  stable/10/sys/dev/isp/isp_freebsd.c
  stable/10/sys/dev/isp/ispmbox.h
  stable/10/sys/dev/isp/ispvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp.c
==
--- stable/10/sys/dev/isp/isp.c Wed May 10 18:59:18 2017(r318148)
+++ stable/10/sys/dev/isp/isp.c Wed May 10 18:59:20 2017(r318149)
@@ -2771,10 +2771,11 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui
pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits);
ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8);
ISP_MEMCPY(pdb->nodename, un.bill.pdb_nodename, 8);
-   isp_prt(isp, ISP_LOGDEBUG1,
-   "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x",
+   isp_prt(isp, ISP_LOGDEBUG0,
+   "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x 
laststate %x",
chan, id, pdb->portid, un.bill.pdb_flags,
-   un.bill.pdb_curstate);
+   un.bill.pdb_curstate, un.bill.pdb_laststate);
+
if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || 
un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) {
mbs.param[0] = MBOX_NOT_LOGGED_IN;
return (mbs.param[0]);

Modified: stable/10/sys/dev/isp/isp_freebsd.c
==
--- stable/10/sys/dev/isp/isp_freebsd.c Wed May 10 18:59:18 2017
(r318148)
+++ stable/10/sys/dev/isp/isp_freebsd.c Wed May 10 18:59:20 2017
(r318149)
@@ -2567,8 +2567,7 @@ isp_watchdog(void *arg)
} 
isp_destroy_handle(isp, handle);
isp_prt(isp, ISP_LOGERR, "%s: timeout for handle 

svn commit: r318148 - stable/11/sys/dev/isp

2017-05-10 Thread Kenneth D. Merry
Author: ken
Date: Wed May 10 18:59:18 2017
New Revision: 318148
URL: https://svnweb.freebsd.org/changeset/base/318148

Log:
  MFC r317740:
  
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

Modified:
  stable/11/sys/dev/isp/isp.c
  stable/11/sys/dev/isp/isp_freebsd.c
  stable/11/sys/dev/isp/ispmbox.h
  stable/11/sys/dev/isp/ispvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp.c
==
--- stable/11/sys/dev/isp/isp.c Wed May 10 18:33:40 2017(r318147)
+++ stable/11/sys/dev/isp/isp.c Wed May 10 18:59:18 2017(r318148)
@@ -2771,10 +2771,11 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui
pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits);
ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8);
ISP_MEMCPY(pdb->nodename, un.bill.pdb_nodename, 8);
-   isp_prt(isp, ISP_LOGDEBUG1,
-   "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x",
+   isp_prt(isp, ISP_LOGDEBUG0,
+   "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x 
laststate %x",
chan, id, pdb->portid, un.bill.pdb_flags,
-   un.bill.pdb_curstate);
+   un.bill.pdb_curstate, un.bill.pdb_laststate);
+
if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || 
un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) {
mbs.param[0] = MBOX_NOT_LOGGED_IN;
return (mbs.param[0]);

Modified: stable/11/sys/dev/isp/isp_freebsd.c
==
--- stable/11/sys/dev/isp/isp_freebsd.c Wed May 10 18:33:40 2017
(r318147)
+++ stable/11/sys/dev/isp/isp_freebsd.c Wed May 10 18:59:18 2017
(r318148)
@@ -2567,8 +2567,7 @@ isp_watchdog(void *arg)
} 
isp_destroy_handle(isp, handle);
isp_prt(isp, ISP_LOGERR, "%s: timeout for handle 

svn commit: r318139 - in stable/11: share/man/man4 sys/cam/scsi

2017-05-10 Thread Kenneth D. Merry
Author: ken
Date: Wed May 10 15:20:38 2017
New Revision: 318139
URL: https://svnweb.freebsd.org/changeset/base/318139

Log:
  MFC r317775:
  
Fix error recovery behavior in the pass(4) driver.
  
After FreeBSD SVN revision 236814, the pass(4) driver changed from
only doing error recovery when the CAM_PASS_ERR_RECOVER flag was
set on a CCB to sometimes doing error recovery if the passed in
retry count was non-zero.
  
Error recovery would happen if two conditions were met:
  
1.  The error recovery action was simply a retry.  (Which is most
cases.)
2.  The retry_count is non-zero. (Which happened a lot because of
cut-and-pasted code.)
  
This explains a bug I noticed in with camcontrol:
  
# camcontrol tur da34 -v
Unit is ready
# camcontrol reset da34
Reset of 1:172:0 was successful
  
At this point, there should be a Unit Attention:
  
# camcontrol tur da34 -v
Unit is ready
  
No Unit Attention.
  
Try it again:
  
# camcontrol reset da34
Reset of 1:172:0 was successful
  
Now set the retry_count to 0 for the TUR:
  
# camcontrol tur da34 -v -C 0
Unit is not ready
(pass42:mps1:0:172:0): TEST UNIT READY. CDB: 00 00 00 00 00 00
(pass42:mps1:0:172:0): CAM status: SCSI Status Error
(pass42:mps1:0:172:0): SCSI status: Check Condition
(pass42:mps1:0:172:0): SCSI sense: UNIT ATTENTION asc:29,2 (SCSI bus reset
occurred)
(pass42:mps1:0:172:0): Field Replaceable Unit: 2
  
There is the unit attention. camcontrol(8) has a default
retry_count of 1, in case someone sets the -E flag without
setting -C.
  
The CAM_PASS_ERR_RECOVER behavior was only broken with the
CAMIOCOMMAND ioctl, which is the synchronous pass(4) API.  It has
worked as intended (error recovery is only done when the flag
is set) in the asynchronous API (CAMIOQUEUE ioctl).
  
sys/cam/scsi/scsi_pass.c:
In passsendccb(), when calling cam_periph_runccb(), only
specify the error routine when CAM_PASS_ERR_RECOVER is set.
  
share/man/man4/pass.4:
Document that CAM_PASS_ERR_RECOVER is needed to enable
error recovery.
  
  Reported by:  Terry Kennedy 
  PR:   kern/218572
  Sponsored by: Spectra Logic

Modified:
  stable/11/share/man/man4/pass.4
  stable/11/sys/cam/scsi/scsi_pass.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/pass.4
==
--- stable/11/share/man/man4/pass.4 Wed May 10 14:54:32 2017
(r318138)
+++ stable/11/share/man/man4/pass.4 Wed May 10 15:20:38 2017
(r318139)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 17, 2015
+.Dd May 3, 2017
 .Dt PASS 4
 .Os
 .Sh NAME
@@ -85,6 +85,11 @@ Some examples of xpt-only CCBs are XPT_S
 XPT_DEV_MATCH, XPT_RESET_BUS, XPT_SCAN_LUN, XPT_ENG_INQ, and XPT_ENG_EXEC.
 These CCB types have various attributes that make it illogical or
 impossible to service them through the passthrough interface.
+.Pp
+If the user would like the kernel to do error recovery, the
+.Dv CAM_PASS_ERR_RECOVER
+flag must be set on the CCB, and the retry_count field set to the number
+of retries.
 .It CAMGETPASSTHRU union ccb *
 This ioctl takes an XPT_GDEVLIST CCB, and returns the passthrough device
 corresponding to the device in question.
@@ -160,6 +165,11 @@ available for userland use with the
 and
 .Dv CAMIOGET
 ioctls and will be preserved across calls.
+.Pp
+If the user would like the kernel to do error recovery, the
+.Dv CAM_PASS_ERR_RECOVER
+flag must be set on the CCB, and the retry_count field set to the number
+of retries.
 .It CAMIOGET union ccb *
 Retrieve completed CAM CCBs queued via the
 .Dv CAMIOQUEUE

Modified: stable/11/sys/cam/scsi/scsi_pass.c
==
--- stable/11/sys/cam/scsi/scsi_pass.c  Wed May 10 14:54:32 2017
(r318138)
+++ stable/11/sys/cam/scsi/scsi_pass.c  Wed May 10 15:20:38 2017
(r318139)
@@ -2213,9 +2213,9 @@ passsendccb(struct cam_periph *periph, u
 * that request.  Otherwise, it's up to the user to perform any
 * error recovery.
 */
-   cam_periph_runccb(ccb, passerror, /* cam_flags */ CAM_RETRY_SELTO,
-   /* sense_flags */ ((ccb->ccb_h.flags & CAM_PASS_ERR_RECOVER) ?
-SF_RETRY_UA : SF_NO_RECOVERY) | SF_NO_PRINT,
+   cam_periph_runccb(ccb, (ccb->ccb_h.flags & CAM_PASS_ERR_RECOVER) ? 
+   passerror : NULL, /* cam_flags */ CAM_RETRY_SELTO,
+   /* sense_flags */ SF_RETRY_UA | SF_NO_PRINT,
softc->device_stats);
 
cam_periph_unmapmem(ccb, );
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318140 - in stable/10: share/man/man4 sys/cam/scsi

2017-05-10 Thread Kenneth D. Merry
Author: ken
Date: Wed May 10 15:20:39 2017
New Revision: 318140
URL: https://svnweb.freebsd.org/changeset/base/318140

Log:
  MFC r317775:
  
Fix error recovery behavior in the pass(4) driver.
  
After FreeBSD SVN revision 236814, the pass(4) driver changed from
only doing error recovery when the CAM_PASS_ERR_RECOVER flag was
set on a CCB to sometimes doing error recovery if the passed in
retry count was non-zero.
  
Error recovery would happen if two conditions were met:
  
1.  The error recovery action was simply a retry.  (Which is most
cases.)
2.  The retry_count is non-zero. (Which happened a lot because of
cut-and-pasted code.)
  
This explains a bug I noticed in with camcontrol:
  
# camcontrol tur da34 -v
Unit is ready
# camcontrol reset da34
Reset of 1:172:0 was successful
  
At this point, there should be a Unit Attention:
  
# camcontrol tur da34 -v
Unit is ready
  
No Unit Attention.
  
Try it again:
  
# camcontrol reset da34
Reset of 1:172:0 was successful
  
Now set the retry_count to 0 for the TUR:
  
# camcontrol tur da34 -v -C 0
Unit is not ready
(pass42:mps1:0:172:0): TEST UNIT READY. CDB: 00 00 00 00 00 00
(pass42:mps1:0:172:0): CAM status: SCSI Status Error
(pass42:mps1:0:172:0): SCSI status: Check Condition
(pass42:mps1:0:172:0): SCSI sense: UNIT ATTENTION asc:29,2 (SCSI bus reset
occurred)
(pass42:mps1:0:172:0): Field Replaceable Unit: 2
  
There is the unit attention. camcontrol(8) has a default
retry_count of 1, in case someone sets the -E flag without
setting -C.
  
The CAM_PASS_ERR_RECOVER behavior was only broken with the
CAMIOCOMMAND ioctl, which is the synchronous pass(4) API.  It has
worked as intended (error recovery is only done when the flag
is set) in the asynchronous API (CAMIOQUEUE ioctl).
  
sys/cam/scsi/scsi_pass.c:
In passsendccb(), when calling cam_periph_runccb(), only
specify the error routine when CAM_PASS_ERR_RECOVER is set.
  
share/man/man4/pass.4:
Document that CAM_PASS_ERR_RECOVER is needed to enable
error recovery.
  
  Reported by:  Terry Kennedy 
  PR:   kern/218572
  Sponsored by: Spectra Logic

Modified:
  stable/10/share/man/man4/pass.4
  stable/10/sys/cam/scsi/scsi_pass.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/pass.4
==
--- stable/10/share/man/man4/pass.4 Wed May 10 15:20:38 2017
(r318139)
+++ stable/10/share/man/man4/pass.4 Wed May 10 15:20:39 2017
(r318140)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 17, 2015
+.Dd May 3, 2017
 .Dt PASS 4
 .Os
 .Sh NAME
@@ -85,6 +85,11 @@ Some examples of xpt-only CCBs are XPT_S
 XPT_DEV_MATCH, XPT_RESET_BUS, XPT_SCAN_LUN, XPT_ENG_INQ, and XPT_ENG_EXEC.
 These CCB types have various attributes that make it illogical or
 impossible to service them through the passthrough interface.
+.Pp
+If the user would like the kernel to do error recovery, the
+.Dv CAM_PASS_ERR_RECOVER
+flag must be set on the CCB, and the retry_count field set to the number
+of retries.
 .It CAMGETPASSTHRU union ccb *
 This ioctl takes an XPT_GDEVLIST CCB, and returns the passthrough device
 corresponding to the device in question.
@@ -160,6 +165,11 @@ available for userland use with the
 and
 .Dv CAMIOGET
 ioctls and will be preserved across calls.
+.Pp
+If the user would like the kernel to do error recovery, the
+.Dv CAM_PASS_ERR_RECOVER
+flag must be set on the CCB, and the retry_count field set to the number
+of retries.
 .It CAMIOGET union ccb *
 Retrieve completed CAM CCBs queued via the
 .Dv CAMIOQUEUE

Modified: stable/10/sys/cam/scsi/scsi_pass.c
==
--- stable/10/sys/cam/scsi/scsi_pass.c  Wed May 10 15:20:38 2017
(r318139)
+++ stable/10/sys/cam/scsi/scsi_pass.c  Wed May 10 15:20:39 2017
(r318140)
@@ -2216,9 +2216,9 @@ passsendccb(struct cam_periph *periph, u
 * that request.  Otherwise, it's up to the user to perform any
 * error recovery.
 */
-   cam_periph_runccb(ccb, passerror, /* cam_flags */ CAM_RETRY_SELTO,
-   /* sense_flags */ ((ccb->ccb_h.flags & CAM_PASS_ERR_RECOVER) ?
-SF_RETRY_UA : SF_NO_RECOVERY) | SF_NO_PRINT,
+   cam_periph_runccb(ccb, (ccb->ccb_h.flags & CAM_PASS_ERR_RECOVER) ? 
+   passerror : NULL, /* cam_flags */ CAM_RETRY_SELTO,
+   /* sense_flags */ SF_RETRY_UA | SF_NO_PRINT,
softc->device_stats);
 
cam_periph_unmapmem(ccb, );
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317966 - stable/10/sbin/camcontrol

2017-05-08 Thread Kenneth D. Merry
Author: ken
Date: Mon May  8 18:30:56 2017
New Revision: 317966
URL: https://svnweb.freebsd.org/changeset/base/317966

Log:
  MFC r317854:
  
When editing a mode page on a tape drive, do not clear the device
specific parameter.
  
Tape drives include write protect (WP), Buffered Mode and Speed
settings in the device-specific parameter.  Clearing this
parameter on a mode select can have the effect of turning off
write protect or buffered mode, or changing the speed setting of
the tape drive.
  
Disks report DPO/FUA support via the device specific parameter
for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
clear this for disks (and other non-tape devices) to avoid
potential errors from the target device.
  
sbin/camcontrol/modeedit.c:
Clear the device-specific parameter in the mode page
header if we're not operating on a tape drive.
  
  Sponsored by: Spectra Logic

Modified:
  stable/10/sbin/camcontrol/modeedit.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/camcontrol/modeedit.c
==
--- stable/10/sbin/camcontrol/modeedit.cMon May  8 18:30:55 2017
(r317965)
+++ stable/10/sbin/camcontrol/modeedit.cMon May  8 18:30:56 2017
(r317966)
@@ -629,8 +629,21 @@ editlist_save(struct cam_device *device,
 
/* Recalculate headers & offsets. */
mh->data_length = 0;/* Reserved for MODE SELECT command. */
-   mh->dev_spec = 0;   /* Clear device-specific parameters. */
mh->blk_desc_len = 0;   /* No block descriptors. */
+   /*
+* Tape drives include write protect (WP), Buffered Mode and Speed
+* settings in the device-specific parameter.  Clearing this
+* parameter on a mode select can have the effect of turning off
+* write protect or buffered mode, or changing the speed setting of
+* the tape drive.
+*
+* Disks report DPO/FUA support via the device specific parameter
+* for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
+* clear this for disks (and other non-tape devices) to avoid
+* potential errors from the target device.
+*/
+   if (device->pd_type != T_SEQUENTIAL)
+   mh->dev_spec = 0;
mph = MODE_PAGE_HEADER(mh);
mph->page_code &= ~SMPH_PS; /* Reserved for MODE SELECT command. */
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317965 - stable/11/sbin/camcontrol

2017-05-08 Thread Kenneth D. Merry
Author: ken
Date: Mon May  8 18:30:55 2017
New Revision: 317965
URL: https://svnweb.freebsd.org/changeset/base/317965

Log:
  MFC r317854:
  
When editing a mode page on a tape drive, do not clear the device
specific parameter.
  
Tape drives include write protect (WP), Buffered Mode and Speed
settings in the device-specific parameter.  Clearing this
parameter on a mode select can have the effect of turning off
write protect or buffered mode, or changing the speed setting of
the tape drive.
  
Disks report DPO/FUA support via the device specific parameter
for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
clear this for disks (and other non-tape devices) to avoid
potential errors from the target device.
  
sbin/camcontrol/modeedit.c:
Clear the device-specific parameter in the mode page
header if we're not operating on a tape drive.
  
  Sponsored by: Spectra Logic

Modified:
  stable/11/sbin/camcontrol/modeedit.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/camcontrol/modeedit.c
==
--- stable/11/sbin/camcontrol/modeedit.cMon May  8 17:55:51 2017
(r317964)
+++ stable/11/sbin/camcontrol/modeedit.cMon May  8 18:30:55 2017
(r317965)
@@ -629,8 +629,21 @@ editlist_save(struct cam_device *device,
 
/* Recalculate headers & offsets. */
mh->data_length = 0;/* Reserved for MODE SELECT command. */
-   mh->dev_spec = 0;   /* Clear device-specific parameters. */
mh->blk_desc_len = 0;   /* No block descriptors. */
+   /*
+* Tape drives include write protect (WP), Buffered Mode and Speed
+* settings in the device-specific parameter.  Clearing this
+* parameter on a mode select can have the effect of turning off
+* write protect or buffered mode, or changing the speed setting of
+* the tape drive.
+*
+* Disks report DPO/FUA support via the device specific parameter
+* for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
+* clear this for disks (and other non-tape devices) to avoid
+* potential errors from the target device.
+*/
+   if (device->pd_type != T_SEQUENTIAL)
+   mh->dev_spec = 0;
mph = MODE_PAGE_HEADER(mh);
mph->page_code &= ~SMPH_PS; /* Reserved for MODE SELECT command. */
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317963 - in stable/11: share/man/man4 sys/cam/scsi usr.bin/mt

2017-05-08 Thread Kenneth D. Merry
Author: ken
Date: Mon May  8 17:55:49 2017
New Revision: 317963
URL: https://svnweb.freebsd.org/changeset/base/317963

Log:
  MFC r317848:
  
Add basic programmable early warning error injection to the sa(4) driver.
  
This will help application developers simulate end of tape conditions.
  
To inject an error in sa0:
  
sysctl kern.cam.sa.0.inject_eom=1
  
This will return the next read or write request queued with 0 bytes
written.  Any subsequent writes or reads will go along as usual.
  
This will also cause the early warning position flag to get set
for the next position query.  So, 'mt status' will show the BPEW
(Beyond Programmable Early Warning) flag on the first query after
an error injection.  After that, the position flags will be as they
are in the underlying tape drive.
  
Also, update the sa(4) man page to describe tape parameters,
which can be set via 'mt param'.
  
sys/cam/scsi/scsi_sa.c:
In saregister(), create the inject_eom sysctl variable.
  
In sastart(), check to see whether inject_eom is set.  If
so, return the read or write with 0 bytes written to
indicate EOM.  Set the set_pews_status flag so that we
fake PEWS status in the next position call for reads, and the
next 3 calls for writes.  This allows the user to see the BPEW
flag one time via 'mt status'.
  
In sagetpos(), check the set_pews_status flag and fake
PEWS status and decrement the counter if it is set.
  
share/man/man4/sa.4:
Document the inject_eom sysctl variable.
  
Document all of the parameters currently supported via
'mt param'.
  
usr.bin/mt/mt.1:
Point the user to the sa(4) man page for more details on
supported parameters.
  
  Sponsored by: Spectra Logic

Modified:
  stable/11/share/man/man4/sa.4
  stable/11/sys/cam/scsi/scsi_sa.c
  stable/11/usr.bin/mt/mt.1
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/sa.4
==
--- stable/11/share/man/man4/sa.4   Mon May  8 17:21:57 2017
(r317962)
+++ stable/11/share/man/man4/sa.4   Mon May  8 17:55:49 2017
(r317963)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 12, 2015
+.Dd May 5, 2017
 .Dt SA 4
 .Os
 .Sh NAME
@@ -242,6 +242,87 @@ These devices include the QIC family of 
 block devices.
 This has not been determined yet, and they are treated
 as separate behaviors by the driver at this time.)
+.Sh PARAMETERS
+The
+.Nm
+driver supports a number of parameters.
+The user can query parameters using
+.Dq mt param -l
+(which uses the
+.Dv MTIOCPARAMGET
+ioctl) and the user can set parameters using
+.Dq mt param -s 
+(which uses the
+.Dv MTIOCPARAMSET
+ioctl).
+See
+.Xr mt 1
+and
+.Xr mtio 4
+for more details on the interface.
+.Pp
+Supported parameters:
+.Bl -tag -width 5n
+.It sili
+The default is 0.
+When set to 1, it sets the Suppress Incorrect Length Indicator (SILI) bit
+on tape reads.
+Tape drives normally return sense data (which contains the residual) when the
+application reads a block that is not the same length as the amount of data
+requested.
+The SILI bit supresses that notification in most cases.
+See the SSC-5 spec (available at t10.org), specifically the section on the
+READ(6) command, for more information.
+.It eot_warn
+The default is 0.
+By default, the
+.Nm
+driver reports entering Programmable Early Warning, Early Warning and End
+of Media conditions by returning a write with 0 bytes written, and
+.Dv errno
+set to 0.
+If 
+.Va eot_warn
+is set to 1, the
+.Nm
+driver will set
+.Dv errno
+to 
+.Dv ENOSPC
+when it enters any of the out of space conditions.
+.It protection.protection_supported
+This is a read-only parameter, and is set to 1 if the tape drive supports
+protection information.
+.It protection.prot_method
+If protection is supported, set this to the desired protection method
+supported by the tape drive.
+As of SSC-5r03 (available at t10.org), the protection method values are:
+.Bl -tag -width 3n
+.It 0
+No protection.
+.It 1
+Reed-Solomon CRC, 4 bytes in length.
+.It 2
+CRC32C, 4 bytes in length.
+.El
+.It protection.pi_length
+Length of the protection information, see above for lengths.
+.It protection.lbp_w
+If set to 1, enable logical block protection on writes.
+The CRC must be appended to the end of the block written to the tape driver.
+The tape drive will verify the CRC when it receives the block.
+.It protection.lbp_r
+If set to 1, enable logical block protection on reads.
+The CRC will be appended to the end of the block read from the tape driver.
+The application should verify the CRC when it receives the block.
+.It protection.rdbp
+If set to 1, enable logical block protection on the RECOVER BUFFERED DATA
+command.
+The
+.Nm
+driver does not currently use the
+RECOVER BUFFERED DATA command.
+.El
 .Sh IOCTLS
 The
 

svn commit: r317964 - in stable/10: share/man/man4 sys/cam/scsi usr.bin/mt

2017-05-08 Thread Kenneth D. Merry
Author: ken
Date: Mon May  8 17:55:51 2017
New Revision: 317964
URL: https://svnweb.freebsd.org/changeset/base/317964

Log:
  MFC r317848:
  
Add basic programmable early warning error injection to the sa(4) driver.
  
This will help application developers simulate end of tape conditions.
  
To inject an error in sa0:
  
sysctl kern.cam.sa.0.inject_eom=1
  
This will return the next read or write request queued with 0 bytes
written.  Any subsequent writes or reads will go along as usual.
  
This will also cause the early warning position flag to get set
for the next position query.  So, 'mt status' will show the BPEW
(Beyond Programmable Early Warning) flag on the first query after
an error injection.  After that, the position flags will be as they
are in the underlying tape drive.
  
Also, update the sa(4) man page to describe tape parameters,
which can be set via 'mt param'.
  
sys/cam/scsi/scsi_sa.c:
In saregister(), create the inject_eom sysctl variable.
  
In sastart(), check to see whether inject_eom is set.  If
so, return the read or write with 0 bytes written to
indicate EOM.  Set the set_pews_status flag so that we
fake PEWS status in the next position call for reads, and the
next 3 calls for writes.  This allows the user to see the BPEW
flag one time via 'mt status'.
  
In sagetpos(), check the set_pews_status flag and fake
PEWS status and decrement the counter if it is set.
  
share/man/man4/sa.4:
Document the inject_eom sysctl variable.
  
Document all of the parameters currently supported via
'mt param'.
  
usr.bin/mt/mt.1:
Point the user to the sa(4) man page for more details on
supported parameters.
  
  Sponsored by: Spectra Logic

Modified:
  stable/10/share/man/man4/sa.4
  stable/10/sys/cam/scsi/scsi_sa.c
  stable/10/usr.bin/mt/mt.1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/sa.4
==
--- stable/10/share/man/man4/sa.4   Mon May  8 17:55:49 2017
(r317963)
+++ stable/10/share/man/man4/sa.4   Mon May  8 17:55:51 2017
(r317964)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 12, 2015
+.Dd May 5, 2017
 .Dt SA 4
 .Os
 .Sh NAME
@@ -242,6 +242,87 @@ These devices include the QIC family of 
 block devices.
 This has not been determined yet, and they are treated
 as separate behaviors by the driver at this time.)
+.Sh PARAMETERS
+The
+.Nm
+driver supports a number of parameters.
+The user can query parameters using
+.Dq mt param -l
+(which uses the
+.Dv MTIOCPARAMGET
+ioctl) and the user can set parameters using
+.Dq mt param -s 
+(which uses the
+.Dv MTIOCPARAMSET
+ioctl).
+See
+.Xr mt 1
+and
+.Xr mtio 4
+for more details on the interface.
+.Pp
+Supported parameters:
+.Bl -tag -width 5n
+.It sili
+The default is 0.
+When set to 1, it sets the Suppress Incorrect Length Indicator (SILI) bit
+on tape reads.
+Tape drives normally return sense data (which contains the residual) when the
+application reads a block that is not the same length as the amount of data
+requested.
+The SILI bit supresses that notification in most cases.
+See the SSC-5 spec (available at t10.org), specifically the section on the
+READ(6) command, for more information.
+.It eot_warn
+The default is 0.
+By default, the
+.Nm
+driver reports entering Programmable Early Warning, Early Warning and End
+of Media conditions by returning a write with 0 bytes written, and
+.Dv errno
+set to 0.
+If 
+.Va eot_warn
+is set to 1, the
+.Nm
+driver will set
+.Dv errno
+to 
+.Dv ENOSPC
+when it enters any of the out of space conditions.
+.It protection.protection_supported
+This is a read-only parameter, and is set to 1 if the tape drive supports
+protection information.
+.It protection.prot_method
+If protection is supported, set this to the desired protection method
+supported by the tape drive.
+As of SSC-5r03 (available at t10.org), the protection method values are:
+.Bl -tag -width 3n
+.It 0
+No protection.
+.It 1
+Reed-Solomon CRC, 4 bytes in length.
+.It 2
+CRC32C, 4 bytes in length.
+.El
+.It protection.pi_length
+Length of the protection information, see above for lengths.
+.It protection.lbp_w
+If set to 1, enable logical block protection on writes.
+The CRC must be appended to the end of the block written to the tape driver.
+The tape drive will verify the CRC when it receives the block.
+.It protection.lbp_r
+If set to 1, enable logical block protection on reads.
+The CRC will be appended to the end of the block read from the tape driver.
+The application should verify the CRC when it receives the block.
+.It protection.rdbp
+If set to 1, enable logical block protection on the RECOVER BUFFERED DATA
+command.
+The
+.Nm
+driver does not currently use the
+RECOVER BUFFERED DATA command.
+.El
 .Sh IOCTLS
 The
 

svn commit: r317962 - stable/10/sys/cam/scsi

2017-05-08 Thread Kenneth D. Merry
Author: ken
Date: Mon May  8 17:21:57 2017
New Revision: 317962
URL: https://svnweb.freebsd.org/changeset/base/317962

Log:
  MFC r317799:
  
Add the SCSI Solid State Media Log page (0x11) definition.
  
sys/cam/scsi/scsi_all.h:
Add the SCSI Solid State Media log page (0x11) structure
definition.  This gives the percentage used (in terms of
lifetime flash wear) of an SSD.
  
  Sponsored by: Spectra Logic

Modified:
  stable/10/sys/cam/scsi/scsi_all.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_all.h
==
--- stable/10/sys/cam/scsi/scsi_all.h   Mon May  8 17:21:55 2017
(r317961)
+++ stable/10/sys/cam/scsi/scsi_all.h   Mon May  8 17:21:57 2017
(r317962)
@@ -565,6 +565,7 @@ struct scsi_log_sense
 #defineSLS_ERROR_LASTN_PAGE0x07
 #defineSLS_LOGICAL_BLOCK_PROVISIONING  0x0c
 #defineSLS_SELF_TEST_PAGE  0x10
+#defineSLS_SOLID_STATE_MEDIA   0x11
 #defineSLS_STAT_AND_PERF   0x19
 #defineSLS_IE_PAGE 0x2f
 #defineSLS_PAGE_CTRL_MASK  0xC0
@@ -624,6 +625,13 @@ struct scsi_log_param_header {
u_int8_t param_len;
 };
 
+struct scsi_log_media_pct_used {
+   struct scsi_log_param_header hdr;
+#defineSLP_SS_MEDIA_PCT_USED   0x0001
+   uint8_t reserved[3];
+   uint8_t pct_used;
+};
+
 struct scsi_log_stat_and_perf {
struct scsi_log_param_header hdr;
 #defineSLP_SAP 0x0001
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317961 - stable/11/sys/cam/scsi

2017-05-08 Thread Kenneth D. Merry
Author: ken
Date: Mon May  8 17:21:55 2017
New Revision: 317961
URL: https://svnweb.freebsd.org/changeset/base/317961

Log:
  MFC r317799:
  
Add the SCSI Solid State Media Log page (0x11) definition.
  
sys/cam/scsi/scsi_all.h:
Add the SCSI Solid State Media log page (0x11) structure
definition.  This gives the percentage used (in terms of
lifetime flash wear) of an SSD.
  
  Sponsored by: Spectra Logic

Modified:
  stable/11/sys/cam/scsi/scsi_all.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_all.h
==
--- stable/11/sys/cam/scsi/scsi_all.h   Mon May  8 17:14:01 2017
(r317960)
+++ stable/11/sys/cam/scsi/scsi_all.h   Mon May  8 17:21:55 2017
(r317961)
@@ -565,6 +565,7 @@ struct scsi_log_sense
 #defineSLS_ERROR_LASTN_PAGE0x07
 #defineSLS_LOGICAL_BLOCK_PROVISIONING  0x0c
 #defineSLS_SELF_TEST_PAGE  0x10
+#defineSLS_SOLID_STATE_MEDIA   0x11
 #defineSLS_STAT_AND_PERF   0x19
 #defineSLS_IE_PAGE 0x2f
 #defineSLS_PAGE_CTRL_MASK  0xC0
@@ -624,6 +625,13 @@ struct scsi_log_param_header {
u_int8_t param_len;
 };
 
+struct scsi_log_media_pct_used {
+   struct scsi_log_param_header hdr;
+#defineSLP_SS_MEDIA_PCT_USED   0x0001
+   uint8_t reserved[3];
+   uint8_t pct_used;
+};
+
 struct scsi_log_stat_and_perf {
struct scsi_log_param_header hdr;
 #defineSLP_SAP 0x0001
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317947 - stable/10/sbin/camcontrol

2017-05-08 Thread Kenneth D. Merry
Author: ken
Date: Mon May  8 17:02:03 2017
New Revision: 317947
URL: https://svnweb.freebsd.org/changeset/base/317947

Log:
  MFC r317774, r317776
  
  r317774:
Add the ability to rescan or reset devices specified by peripheral
name and unit number in camcontrol(8).
  
Previously camcontrol(8) only supported rescanning or resetting
devices specified by bus:target:lun.  This is because for
rescanning at least, you don't have a peripheral name and unit
number (e.g. da4) for devices that don't exist yet.
  
That is still the case after this change, but in other cases, when
the device does exist in the CAM EDT (Existing Device Table), we
do a careful lookup of the bus/target/lun if the user supplies a
peripheral name and unit number to find the bus:target:lun and then
issue the requested reset or rescan.
  
The lookup is done without actually opening the device in question,
since a rescan is often done to make a device go away after it has
been pulled.  (This is especially true for busses/controllers, like
parallel SCSI controllers, that don't automatically detect changes
in topology.)  Opening a device that is no longer there to
determine the bus/target/lun might result in error recovery actions
when the user really just wanted to make the device go away.
  
sbin/camcontrol/camcontrol.c:
In dorescan_or_reset(), if the use hasn't specified a
numeric argument, assume he has specified a device.  Lookup
the pass(4) instance for that device using the transport
layer CAMGETPASSTHRU ioctl.  If that is successful, we can
use the returned bus:target:lun to rescan or reset the
device.
  
Under the hood, resetting a device using XPT_RESET_DEV is
actually sent via the pass(4) device anyway.  But this
provides a way for the user to specify devices in a more
convenient way, and can work on device rescans when the
device is going away, assuming it still exists in the EDT.
  
sbin/camcontrol/camcontrol.8:
Update the man page for the rescan and reset subcommands
to reflect that you can now use a device name and unit
number with them.
  
  Sponsored by: Spectra Logic
  
  r317776:
Bump the camcontrol(8) man page date.
  
  Sponsored by: Spectra Logic

Modified:
  stable/10/sbin/camcontrol/camcontrol.8
  stable/10/sbin/camcontrol/camcontrol.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/camcontrol/camcontrol.8
==
--- stable/10/sbin/camcontrol/camcontrol.8  Mon May  8 17:02:01 2017
(r317946)
+++ stable/10/sbin/camcontrol/camcontrol.8  Mon May  8 17:02:03 2017
(r317947)
@@ -102,10 +102,10 @@
 .Op device id
 .Nm
 .Ic rescan
-.Aq all | bus Ns Op :target:lun
+.Aq all | device id | bus Ns Op :target:lun
 .Nm
 .Ic reset
-.Aq all | bus Ns Op :target:lun
+.Aq all | device id | bus Ns Op :target:lun
 .Nm
 .Ic defects
 .Op device id
@@ -553,12 +553,20 @@ start bit cleared and the load/eject bit
 .It Ic rescan
 Tell the kernel to scan all busses in the system (with the
 .Ar all
-argument), the given bus (XPT_SCAN_BUS), or bus:target:lun
+argument), the given bus (XPT_SCAN_BUS), bus:target:lun or device
 (XPT_SCAN_LUN) for new devices or devices that have gone away.
 The user
 may specify a scan of all busses, a single bus, or a lun.
 Scanning all luns
 on a target is not supported.
+.Pp
+If a device is specified by peripheral name and unit number, for instance
+da4, it may only be rescanned if that device currently exists in the CAM EDT
+(Existing Device Table).
+If the device is no longer there (see
+.Nm
+devlist ),
+you must use the bus:target:lun form to rescan it.
 .It Ic reprobe
 Tell the kernel to refresh the information about the device and
 notify the upper layer,
@@ -568,8 +576,8 @@ the disk size visible to the rest of the
 .It Ic reset
 Tell the kernel to reset all busses in the system (with the
 .Ar all
-argument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus
-reset for that bus, or to reset the given bus:target:lun
+argument), the given bus (XPT_RESET_BUS) by issuing a SCSI bus
+reset for that bus, or to reset the given bus:target:lun or device
 (XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
 connecting to that device.
 Note that this can have a destructive impact

Modified: stable/10/sbin/camcontrol/camcontrol.c
==
--- stable/10/sbin/camcontrol/camcontrol.c  Mon May  8 17:02:01 2017
(r317946)
+++ stable/10/sbin/camcontrol/camcontrol.c  Mon May  8 17:02:03 2017
(r317947)
@@ -3126,12 +3126,107 @@ dorescan_or_reset(int argc, char **argv,
tstr++;
if (strncasecmp(tstr, "all", strlen("all")) == 0)
arglist |= CAM_ARG_BUS;
-   else {
+  

svn commit: r317946 - stable/11/sbin/camcontrol

2017-05-08 Thread Kenneth D. Merry
Author: ken
Date: Mon May  8 17:02:01 2017
New Revision: 317946
URL: https://svnweb.freebsd.org/changeset/base/317946

Log:
  MFC r317774, r317776
  
  r317774:
Add the ability to rescan or reset devices specified by peripheral
name and unit number in camcontrol(8).
  
Previously camcontrol(8) only supported rescanning or resetting
devices specified by bus:target:lun.  This is because for
rescanning at least, you don't have a peripheral name and unit
number (e.g. da4) for devices that don't exist yet.
  
That is still the case after this change, but in other cases, when
the device does exist in the CAM EDT (Existing Device Table), we
do a careful lookup of the bus/target/lun if the user supplies a
peripheral name and unit number to find the bus:target:lun and then
issue the requested reset or rescan.
  
The lookup is done without actually opening the device in question,
since a rescan is often done to make a device go away after it has
been pulled.  (This is especially true for busses/controllers, like
parallel SCSI controllers, that don't automatically detect changes
in topology.)  Opening a device that is no longer there to
determine the bus/target/lun might result in error recovery actions
when the user really just wanted to make the device go away.
  
sbin/camcontrol/camcontrol.c:
In dorescan_or_reset(), if the use hasn't specified a
numeric argument, assume he has specified a device.  Lookup
the pass(4) instance for that device using the transport
layer CAMGETPASSTHRU ioctl.  If that is successful, we can
use the returned bus:target:lun to rescan or reset the
device.
  
Under the hood, resetting a device using XPT_RESET_DEV is
actually sent via the pass(4) device anyway.  But this
provides a way for the user to specify devices in a more
convenient way, and can work on device rescans when the
device is going away, assuming it still exists in the EDT.
  
sbin/camcontrol/camcontrol.8:
Update the man page for the rescan and reset subcommands
to reflect that you can now use a device name and unit
number with them.
  
  Sponsored by: Spectra Logic
  
  r317776:
Bump the camcontrol(8) man page date.
  
  Sponsored by: Spectra Logic

Modified:
  stable/11/sbin/camcontrol/camcontrol.8
  stable/11/sbin/camcontrol/camcontrol.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Mon May  8 16:57:33 2017
(r317945)
+++ stable/11/sbin/camcontrol/camcontrol.8  Mon May  8 17:02:01 2017
(r317946)
@@ -102,10 +102,10 @@
 .Op device id
 .Nm
 .Ic rescan
-.Aq all | bus Ns Op :target:lun
+.Aq all | device id | bus Ns Op :target:lun
 .Nm
 .Ic reset
-.Aq all | bus Ns Op :target:lun
+.Aq all | device id | bus Ns Op :target:lun
 .Nm
 .Ic defects
 .Op device id
@@ -578,12 +578,20 @@ start bit cleared and the load/eject bit
 .It Ic rescan
 Tell the kernel to scan all busses in the system (with the
 .Ar all
-argument), the given bus (XPT_SCAN_BUS), or bus:target:lun
+argument), the given bus (XPT_SCAN_BUS), bus:target:lun or device
 (XPT_SCAN_LUN) for new devices or devices that have gone away.
 The user
 may specify a scan of all busses, a single bus, or a lun.
 Scanning all luns
 on a target is not supported.
+.Pp
+If a device is specified by peripheral name and unit number, for instance
+da4, it may only be rescanned if that device currently exists in the CAM EDT
+(Existing Device Table).
+If the device is no longer there (see
+.Nm
+devlist ),
+you must use the bus:target:lun form to rescan it.
 .It Ic reprobe
 Tell the kernel to refresh the information about the device and
 notify the upper layer,
@@ -593,8 +601,8 @@ the disk size visible to the rest of the
 .It Ic reset
 Tell the kernel to reset all busses in the system (with the
 .Ar all
-argument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus
-reset for that bus, or to reset the given bus:target:lun
+argument), the given bus (XPT_RESET_BUS) by issuing a SCSI bus
+reset for that bus, or to reset the given bus:target:lun or device
 (XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
 connecting to that device.
 Note that this can have a destructive impact

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Mon May  8 16:57:33 2017
(r317945)
+++ stable/11/sbin/camcontrol/camcontrol.c  Mon May  8 17:02:01 2017
(r317946)
@@ -3131,12 +3131,107 @@ dorescan_or_reset(int argc, char **argv,
tstr++;
if (strncasecmp(tstr, "all", strlen("all")) == 0)
arglist |= CAM_ARG_BUS;
-   else {
+  

svn commit: r317940 - stable/11/sys/cam/scsi

2017-05-08 Thread Kenneth D. Merry
Author: ken
Date: Mon May  8 14:48:37 2017
New Revision: 317940
URL: https://svnweb.freebsd.org/changeset/base/317940

Log:
  MFC r317745:
  
Don't bother retrying errors for encrypted drives that are locked.
  
sys/cam/scsi/scsi_all.c:
In the asc_table, if we get a 0x20,0x02 error ("Access denied -
no access rights"), don't bother retrying.  Instead, immediately
fail the command.
  
This is the error returned by Self Encrypting Drives (SED) when
they are locked.
  
  Sponsored by: Spectra Logic

Modified:
  stable/11/sys/cam/scsi/scsi_all.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_all.c
==
--- stable/11/sys/cam/scsi/scsi_all.c   Mon May  8 14:33:38 2017
(r317939)
+++ stable/11/sys/cam/scsi/scsi_all.c   Mon May  8 14:48:37 2017
(r317940)
@@ -1614,7 +1614,7 @@ static struct asc_table_entry asc_table[
{ SST(0x20, 0x01, SS_RDEF,  /* XXX TBD */
"Access denied - initiator pending-enrolled") },
/* DT PWROMAEBK   */
-   { SST(0x20, 0x02, SS_RDEF,  /* XXX TBD */
+   { SST(0x20, 0x02, SS_FATAL | EPERM,
"Access denied - no access rights") },
/* DT PWROMAEBK   */
{ SST(0x20, 0x03, SS_RDEF,  /* XXX TBD */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317941 - stable/10/sys/cam/scsi

2017-05-08 Thread Kenneth D. Merry
Author: ken
Date: Mon May  8 14:48:39 2017
New Revision: 317941
URL: https://svnweb.freebsd.org/changeset/base/317941

Log:
  MFC r317745:
  
Don't bother retrying errors for encrypted drives that are locked.
  
sys/cam/scsi/scsi_all.c:
In the asc_table, if we get a 0x20,0x02 error ("Access denied -
no access rights"), don't bother retrying.  Instead, immediately
fail the command.
  
This is the error returned by Self Encrypting Drives (SED) when
they are locked.
  
  Sponsored by: Spectra Logic

Modified:
  stable/10/sys/cam/scsi/scsi_all.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_all.c
==
--- stable/10/sys/cam/scsi/scsi_all.c   Mon May  8 14:48:37 2017
(r317940)
+++ stable/10/sys/cam/scsi/scsi_all.c   Mon May  8 14:48:39 2017
(r317941)
@@ -1613,7 +1613,7 @@ static struct asc_table_entry asc_table[
{ SST(0x20, 0x01, SS_RDEF,  /* XXX TBD */
"Access denied - initiator pending-enrolled") },
/* DT PWROMAEBK   */
-   { SST(0x20, 0x02, SS_RDEF,  /* XXX TBD */
+   { SST(0x20, 0x02, SS_FATAL | EPERM,
"Access denied - no access rights") },
/* DT PWROMAEBK   */
{ SST(0x20, 0x03, SS_RDEF,  /* XXX TBD */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317854 - head/sbin/camcontrol

2017-05-05 Thread Kenneth D. Merry
Author: ken
Date: Fri May  5 21:29:28 2017
New Revision: 317854
URL: https://svnweb.freebsd.org/changeset/base/317854

Log:
  When editing a mode page on a tape drive, do not clear the device
  specific parameter.
  
  Tape drives include write protect (WP), Buffered Mode and Speed
  settings in the device-specific parameter.  Clearing this
  parameter on a mode select can have the effect of turning off
  write protect or buffered mode, or changing the speed setting of
  the tape drive.
  
  Disks report DPO/FUA support via the device specific parameter
  for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
  clear this for disks (and other non-tape devices) to avoid
  potential errors from the target device.
  
  sbin/camcontrol/modeedit.c:
Clear the device-specific parameter in the mode page
header if we're not operating on a tape drive.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sbin/camcontrol/modeedit.c

Modified: head/sbin/camcontrol/modeedit.c
==
--- head/sbin/camcontrol/modeedit.c Fri May  5 20:45:55 2017
(r317853)
+++ head/sbin/camcontrol/modeedit.c Fri May  5 21:29:28 2017
(r317854)
@@ -629,8 +629,21 @@ editlist_save(struct cam_device *device,
 
/* Recalculate headers & offsets. */
mh->data_length = 0;/* Reserved for MODE SELECT command. */
-   mh->dev_spec = 0;   /* Clear device-specific parameters. */
mh->blk_desc_len = 0;   /* No block descriptors. */
+   /*
+* Tape drives include write protect (WP), Buffered Mode and Speed
+* settings in the device-specific parameter.  Clearing this
+* parameter on a mode select can have the effect of turning off
+* write protect or buffered mode, or changing the speed setting of
+* the tape drive.
+*
+* Disks report DPO/FUA support via the device specific parameter
+* for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
+* clear this for disks (and other non-tape devices) to avoid
+* potential errors from the target device.
+*/
+   if (device->pd_type != T_SEQUENTIAL)
+   mh->dev_spec = 0;
mph = MODE_PAGE_HEADER(mh);
mph->page_code &= ~SMPH_PS; /* Reserved for MODE SELECT command. */
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317852 - stable/11

2017-05-05 Thread Kenneth D. Merry
Author: ken
Date: Fri May  5 20:41:29 2017
New Revision: 317852
URL: https://svnweb.freebsd.org/changeset/base/317852

Log:
  Add mergeinfo that should have been included in r317850.
  
  Original commit message for r317850:
  
  MFC r317680:
  
Add the SCSI SSC Manufacturer assigned serial number VPD page.
  
This is current as of SSC-5r03.
  
  Submitted by: Sam Klopsch
  Sponsored by: Spectra Logic

Modified:
Directory Properties:
  stable/11/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317851 - stable/10/sys/cam/scsi

2017-05-05 Thread Kenneth D. Merry
Author: ken
Date: Fri May  5 20:25:31 2017
New Revision: 317851
URL: https://svnweb.freebsd.org/changeset/base/317851

Log:
  MFC r317680:
  
Add the SCSI SSC Manufacturer assigned serial number VPD page.
  
This is current as of SSC-5r03.
  
  Submitted by: Sam Klopsch
  Sponsored by: Spectra Logic

Modified:
  stable/10/sys/cam/scsi/scsi_sa.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_sa.h
==
--- stable/10/sys/cam/scsi/scsi_sa.hFri May  5 20:21:13 2017
(r317850)
+++ stable/10/sys/cam/scsi/scsi_sa.hFri May  5 20:25:31 2017
(r317851)
@@ -487,6 +487,19 @@ struct scsi_medium_type_data {
 };
 
 /*
+ * Manufacturer-assigned Serial Number VPD page.
+ * Current as of SSC-5r03, 28 September 2016.
+ */
+struct scsi_vpd_mfg_serial_number
+{
+   u_int8_t device;
+   u_int8_t page_code;
+#defineSVPD_MFG_SERIAL_NUMBER_PAGE_CODE 0xB1
+   u_int8_t page_length[2];
+   u_int8_t mfg_serial_num[];
+};
+
+/*
  * Security Protocol Specific values for the Tape Data Encryption protocol
  * (0x20) used with SECURITY PROTOCOL IN.  See below for values used with
  * SECURITY PROTOCOL OUT.  Current as of SSC4r03.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317850 - stable/11/sys/cam/scsi

2017-05-05 Thread Kenneth D. Merry
Author: ken
Date: Fri May  5 20:21:13 2017
New Revision: 317850
URL: https://svnweb.freebsd.org/changeset/base/317850

Log:
  MFC r317680:
  
Add the SCSI SSC Manufacturer assigned serial number VPD page.
  
This is current as of SSC-5r03.
  
  Submitted by: Sam Klopsch
  Sponsored by: Spectra Logic

Modified:
  stable/11/sys/cam/scsi/scsi_sa.h

Modified: stable/11/sys/cam/scsi/scsi_sa.h
==
--- stable/11/sys/cam/scsi/scsi_sa.hFri May  5 20:06:49 2017
(r317849)
+++ stable/11/sys/cam/scsi/scsi_sa.hFri May  5 20:21:13 2017
(r317850)
@@ -487,6 +487,19 @@ struct scsi_medium_type_data {
 };
 
 /*
+ * Manufacturer-assigned Serial Number VPD page.
+ * Current as of SSC-5r03, 28 September 2016.
+ */
+struct scsi_vpd_mfg_serial_number
+{
+   u_int8_t device;
+   u_int8_t page_code;
+#defineSVPD_MFG_SERIAL_NUMBER_PAGE_CODE 0xB1
+   u_int8_t page_length[2];
+   u_int8_t mfg_serial_num[];
+};
+
+/*
  * Security Protocol Specific values for the Tape Data Encryption protocol
  * (0x20) used with SECURITY PROTOCOL IN.  See below for values used with
  * SECURITY PROTOCOL OUT.  Current as of SSC4r03.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317848 - in head: share/man/man4 sys/cam/scsi usr.bin/mt

2017-05-05 Thread Kenneth D. Merry
Author: ken
Date: Fri May  5 20:00:53 2017
New Revision: 317848
URL: https://svnweb.freebsd.org/changeset/base/317848

Log:
  Add basic programmable early warning error injection to the sa(4) driver.
  
  This will help application developers simulate end of tape conditions.
  
  To inject an error in sa0:
  
  sysctl kern.cam.sa.0.inject_eom=1
  
  This will return the next read or write request queued with 0 bytes
  written.  Any subsequent writes or reads will go along as usual.
  
  This will also cause the early warning position flag to get set
  for the next position query.  So, 'mt status' will show the BPEW
  (Beyond Programmable Early Warning) flag on the first query after
  an error injection.  After that, the position flags will be as they
  are in the underlying tape drive.
  
  Also, update the sa(4) man page to describe tape parameters,
  which can be set via 'mt param'.
  
  sys/cam/scsi/scsi_sa.c:
In saregister(), create the inject_eom sysctl variable.
  
In sastart(), check to see whether inject_eom is set.  If
so, return the read or write with 0 bytes written to
indicate EOM.  Set the set_pews_status flag so that we
fake PEWS status in the next position call for reads, and the
next 3 calls for writes.  This allows the user to see the BPEW
flag one time via 'mt status'.
  
In sagetpos(), check the set_pews_status flag and fake
PEWS status and decrement the counter if it is set.
  
  share/man/man4/sa.4:
Document the inject_eom sysctl variable.
  
Document all of the parameters currently supported via
'mt param'.
  
  usr.bin/mt/mt.1:
Point the user to the sa(4) man page for more details on
supported parameters.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/share/man/man4/sa.4
  head/sys/cam/scsi/scsi_sa.c
  head/usr.bin/mt/mt.1

Modified: head/share/man/man4/sa.4
==
--- head/share/man/man4/sa.4Fri May  5 19:34:05 2017(r317847)
+++ head/share/man/man4/sa.4Fri May  5 20:00:53 2017(r317848)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 12, 2015
+.Dd May 5, 2017
 .Dt SA 4
 .Os
 .Sh NAME
@@ -242,6 +242,87 @@ These devices include the QIC family of 
 block devices.
 This has not been determined yet, and they are treated
 as separate behaviors by the driver at this time.)
+.Sh PARAMETERS
+The
+.Nm
+driver supports a number of parameters.
+The user can query parameters using
+.Dq mt param -l
+(which uses the
+.Dv MTIOCPARAMGET
+ioctl) and the user can set parameters using
+.Dq mt param -s 
+(which uses the
+.Dv MTIOCPARAMSET
+ioctl).
+See
+.Xr mt 1
+and
+.Xr mtio 4
+for more details on the interface.
+.Pp
+Supported parameters:
+.Bl -tag -width 5n
+.It sili
+The default is 0.
+When set to 1, it sets the Suppress Incorrect Length Indicator (SILI) bit
+on tape reads.
+Tape drives normally return sense data (which contains the residual) when the
+application reads a block that is not the same length as the amount of data
+requested.
+The SILI bit supresses that notification in most cases.
+See the SSC-5 spec (available at t10.org), specifically the section on the
+READ(6) command, for more information.
+.It eot_warn
+The default is 0.
+By default, the
+.Nm
+driver reports entering Programmable Early Warning, Early Warning and End
+of Media conditions by returning a write with 0 bytes written, and
+.Dv errno
+set to 0.
+If 
+.Va eot_warn
+is set to 1, the
+.Nm
+driver will set
+.Dv errno
+to 
+.Dv ENOSPC
+when it enters any of the out of space conditions.
+.It protection.protection_supported
+This is a read-only parameter, and is set to 1 if the tape drive supports
+protection information.
+.It protection.prot_method
+If protection is supported, set this to the desired protection method
+supported by the tape drive.
+As of SSC-5r03 (available at t10.org), the protection method values are:
+.Bl -tag -width 3n
+.It 0
+No protection.
+.It 1
+Reed-Solomon CRC, 4 bytes in length.
+.It 2
+CRC32C, 4 bytes in length.
+.El
+.It protection.pi_length
+Length of the protection information, see above for lengths.
+.It protection.lbp_w
+If set to 1, enable logical block protection on writes.
+The CRC must be appended to the end of the block written to the tape driver.
+The tape drive will verify the CRC when it receives the block.
+.It protection.lbp_r
+If set to 1, enable logical block protection on reads.
+The CRC will be appended to the end of the block read from the tape driver.
+The application should verify the CRC when it receives the block.
+.It protection.rdbp
+If set to 1, enable logical block protection on the RECOVER BUFFERED DATA
+command.
+The
+.Nm
+driver does not currently use the
+RECOVER BUFFERED DATA command.
+.El
 .Sh IOCTLS
 The
 .Nm
@@ -262,7 +343,26 @@ Control mode device (to examine state wh
 accessing the device, e.g.).
 .El
 .Sh DIAGNOSTICS

svn commit: r317799 - head/sys/cam/scsi

2017-05-04 Thread Kenneth D. Merry
Author: ken
Date: Thu May  4 17:23:39 2017
New Revision: 317799
URL: https://svnweb.freebsd.org/changeset/base/317799

Log:
  Add the SCSI Solid State Media Log page (0x11) definition.
  
  sys/cam/scsi/scsi_all.h:
Add the SCSI Solid State Media log page (0x11) structure
definition.  This gives the percentage used (in terms of
lifetime flash wear) of an SSD.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/scsi/scsi_all.h
==
--- head/sys/cam/scsi/scsi_all.hThu May  4 15:26:28 2017
(r317798)
+++ head/sys/cam/scsi/scsi_all.hThu May  4 17:23:39 2017
(r317799)
@@ -565,6 +565,7 @@ struct scsi_log_sense
 #defineSLS_ERROR_LASTN_PAGE0x07
 #defineSLS_LOGICAL_BLOCK_PROVISIONING  0x0c
 #defineSLS_SELF_TEST_PAGE  0x10
+#defineSLS_SOLID_STATE_MEDIA   0x11
 #defineSLS_STAT_AND_PERF   0x19
 #defineSLS_IE_PAGE 0x2f
 #defineSLS_PAGE_CTRL_MASK  0xC0
@@ -624,6 +625,13 @@ struct scsi_log_param_header {
u_int8_t param_len;
 };
 
+struct scsi_log_media_pct_used {
+   struct scsi_log_param_header hdr;
+#defineSLP_SS_MEDIA_PCT_USED   0x0001
+   uint8_t reserved[3];
+   uint8_t pct_used;
+};
+
 struct scsi_log_stat_and_perf {
struct scsi_log_param_header hdr;
 #defineSLP_SAP 0x0001
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317792 - stable/11/sbin/camcontrol

2017-05-04 Thread Kenneth D. Merry
Author: ken
Date: Thu May  4 14:20:52 2017
New Revision: 317792
URL: https://svnweb.freebsd.org/changeset/base/317792

Log:
  MFC r317657:
  
Fix camcontrol timestamp setting and update the man page.
  
camcontrol timestamp -s would somtimes fail due to stack garbage.  Zero out
the timestamp parameters to fix it.
  
Fix another nearby bug, and update the man page.
  
sbin/camcontrol/timestamp.c:
In set_timestamp(), bzero ts_p prior to creating the timestamp.
Previously stack garbage could cause some tape drives to reject the
timestamp.
  
In set_timestamp(), check for failures from strptime().
  
sbin/camcontrol/camcontrol.8:
Add the time argument to the -T option to camcontrol timestamp -s
in the long description.
  
Change the time/date format used in the camcontrol timestamp
example to RFC 2822 format.  This fixes a time zone issue with the
original example by specifying the time zone as -0600.  Otherwise,
the time zone seems to default to standard time in the current
locale, which makes the time, when reported back from the drive,
1 hour off from the intended setting.  This also fixes a duplicate
day of the week ("Wednesday Wed") in the previous example.
  
  Submitted by: Sam Klopsch
  Sponsored by: Spectra Logic

Modified:
  stable/11/sbin/camcontrol/camcontrol.8
  stable/11/sbin/camcontrol/timestamp.c

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Thu May  4 12:18:58 2017
(r317791)
+++ stable/11/sbin/camcontrol/camcontrol.8  Thu May  4 14:20:52 2017
(r317792)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 17, 2017
+.Dd May 1, 2017
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -2488,7 +2488,7 @@ Specify the strptime format string, as d
 The time must also be specified with the
 .Fl T 
 option.
-.It Fl T
+.It Fl T Ar time
 Provide the time in the format specified with the
 .Fl f
 option.
@@ -2814,8 +2814,8 @@ drive
 .Pa ada0 .
 .Pp
 .Bd -literal -offset indent
-camcontrol timestamp sa0 -s -f "%A %c" \e
-   -T "Wednesday Wed Oct 26 21:43:57 2016"
+camcontrol timestamp sa0 -s -f "%a, %d %b %Y %T %z" \e
+   -T "Wed, 26 Oct 2016 21:43:57 -0600"
 .Ed
 .Pp
 Set the timestamp of drive

Modified: stable/11/sbin/camcontrol/timestamp.c
==
--- stable/11/sbin/camcontrol/timestamp.c   Thu May  4 12:18:58 2017
(r317791)
+++ stable/11/sbin/camcontrol/timestamp.c   Thu May  4 14:20:52 2017
(r317792)
@@ -282,12 +282,18 @@ set_timestamp(struct cam_device *device,
ts = (uint64_t) time_value;
} else {
bzero(_struct, sizeof(struct tm));
-   strptime(timestamp_string, format_string, _struct);
+   if (strptime(timestamp_string, format_string,
+   _struct) == NULL) {
+   warnx("%s: strptime(3) failed", __func__);
+   error = 1;
+   goto bailout;
+   }
time_value = mktime(_struct);
ts = (uint64_t) time_value;
}
/* Convert time from seconds to milliseconds */
ts *= 1000;
+   bzero(_p, sizeof(ts_p));
scsi_create_timestamp(ts_p.timestamp, ts);
 
scsi_set_timestamp(>csio,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317776 - head/sbin/camcontrol

2017-05-03 Thread Kenneth D. Merry
Author: ken
Date: Wed May  3 21:04:32 2017
New Revision: 317776
URL: https://svnweb.freebsd.org/changeset/base/317776

Log:
  Bump the camcontrol(8) man page date.
  
  MFC after:3 days
  X-MFC-with:   r317774
  Sponsored by: Spectra Logic

Modified:
  head/sbin/camcontrol/camcontrol.8

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Wed May  3 20:59:47 2017
(r317775)
+++ head/sbin/camcontrol/camcontrol.8   Wed May  3 21:04:32 2017
(r317776)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 1, 2017
+.Dd May 3, 2017
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317775 - in head: share/man/man4 sys/cam/scsi

2017-05-03 Thread Kenneth D. Merry
Author: ken
Date: Wed May  3 20:59:47 2017
New Revision: 317775
URL: https://svnweb.freebsd.org/changeset/base/317775

Log:
  Fix error recovery behavior in the pass(4) driver.
  
  After FreeBSD SVN revision 236814, the pass(4) driver changed from
  only doing error recovery when the CAM_PASS_ERR_RECOVER flag was
  set on a CCB to sometimes doing error recovery if the passed in
  retry count was non-zero.
  
  Error recovery would happen if two conditions were met:
  
  1.  The error recovery action was simply a retry.  (Which is most
  cases.)
  2.  The retry_count is non-zero. (Which happened a lot because of
  cut-and-pasted code.)
  
  This explains a bug I noticed in with camcontrol:
  
  # camcontrol tur da34 -v
  Unit is ready
  # camcontrol reset da34
  Reset of 1:172:0 was successful
  
  At this point, there should be a Unit Attention:
  
  # camcontrol tur da34 -v
  Unit is ready
  
  No Unit Attention.
  
  Try it again:
  
  # camcontrol reset da34
  Reset of 1:172:0 was successful
  
  Now set the retry_count to 0 for the TUR:
  
  # camcontrol tur da34 -v -C 0
  Unit is not ready
  (pass42:mps1:0:172:0): TEST UNIT READY. CDB: 00 00 00 00 00 00
  (pass42:mps1:0:172:0): CAM status: SCSI Status Error
  (pass42:mps1:0:172:0): SCSI status: Check Condition
  (pass42:mps1:0:172:0): SCSI sense: UNIT ATTENTION asc:29,2 (SCSI bus reset 
occurred)
  (pass42:mps1:0:172:0): Field Replaceable Unit: 2
  
  There is the unit attention. camcontrol(8) has a default
  retry_count of 1, in case someone sets the -E flag without
  setting -C.
  
  The CAM_PASS_ERR_RECOVER behavior was only broken with the
  CAMIOCOMMAND ioctl, which is the synchronous pass(4) API.  It has
  worked as intended (error recovery is only done when the flag
  is set) in the asynchronous API (CAMIOQUEUE ioctl).
  
  sys/cam/scsi/scsi_pass.c:
In passsendccb(), when calling cam_periph_runccb(), only
specify the error routine when CAM_PASS_ERR_RECOVER is set.
  
  share/man/man4/pass.4:
Document that CAM_PASS_ERR_RECOVER is needed to enable
error recovery.
  
  Reported by:  Terry Kennedy 
  PR:   kern/218572
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/share/man/man4/pass.4
  head/sys/cam/scsi/scsi_pass.c

Modified: head/share/man/man4/pass.4
==
--- head/share/man/man4/pass.4  Wed May  3 20:57:52 2017(r317774)
+++ head/share/man/man4/pass.4  Wed May  3 20:59:47 2017(r317775)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 17, 2015
+.Dd May 3, 2017
 .Dt PASS 4
 .Os
 .Sh NAME
@@ -85,6 +85,11 @@ Some examples of xpt-only CCBs are XPT_S
 XPT_DEV_MATCH, XPT_RESET_BUS, XPT_SCAN_LUN, XPT_ENG_INQ, and XPT_ENG_EXEC.
 These CCB types have various attributes that make it illogical or
 impossible to service them through the passthrough interface.
+.Pp
+If the user would like the kernel to do error recovery, the
+.Dv CAM_PASS_ERR_RECOVER
+flag must be set on the CCB, and the retry_count field set to the number
+of retries.
 .It CAMGETPASSTHRU union ccb *
 This ioctl takes an XPT_GDEVLIST CCB, and returns the passthrough device
 corresponding to the device in question.
@@ -160,6 +165,11 @@ available for userland use with the
 and
 .Dv CAMIOGET
 ioctls and will be preserved across calls.
+.Pp
+If the user would like the kernel to do error recovery, the
+.Dv CAM_PASS_ERR_RECOVER
+flag must be set on the CCB, and the retry_count field set to the number
+of retries.
 .It CAMIOGET union ccb *
 Retrieve completed CAM CCBs queued via the
 .Dv CAMIOQUEUE

Modified: head/sys/cam/scsi/scsi_pass.c
==
--- head/sys/cam/scsi/scsi_pass.c   Wed May  3 20:57:52 2017
(r317774)
+++ head/sys/cam/scsi/scsi_pass.c   Wed May  3 20:59:47 2017
(r317775)
@@ -2229,9 +2229,9 @@ passsendccb(struct cam_periph *periph, u
 * that request.  Otherwise, it's up to the user to perform any
 * error recovery.
 */
-   cam_periph_runccb(ccb, passerror, /* cam_flags */ CAM_RETRY_SELTO,
-   /* sense_flags */ ((ccb->ccb_h.flags & CAM_PASS_ERR_RECOVER) ?
-SF_RETRY_UA : SF_NO_RECOVERY) | SF_NO_PRINT,
+   cam_periph_runccb(ccb, (ccb->ccb_h.flags & CAM_PASS_ERR_RECOVER) ? 
+   passerror : NULL, /* cam_flags */ CAM_RETRY_SELTO,
+   /* sense_flags */ SF_RETRY_UA | SF_NO_PRINT,
softc->device_stats);
 
cam_periph_unmapmem(ccb, );
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317774 - head/sbin/camcontrol

2017-05-03 Thread Kenneth D. Merry
Author: ken
Date: Wed May  3 20:57:52 2017
New Revision: 317774
URL: https://svnweb.freebsd.org/changeset/base/317774

Log:
  Add the ability to rescan or reset devices specified by peripheral
  name and unit number in camcontrol(8).
  
  Previously camcontrol(8) only supported rescanning or resetting
  devices specified by bus:target:lun.  This is because for
  rescanning at least, you don't have a peripheral name and unit
  number (e.g. da4) for devices that don't exist yet.
  
  That is still the case after this change, but in other cases, when
  the device does exist in the CAM EDT (Existing Device Table), we
  do a careful lookup of the bus/target/lun if the user supplies a
  peripheral name and unit number to find the bus:target:lun and then
  issue the requested reset or rescan.
  
  The lookup is done without actually opening the device in question,
  since a rescan is often done to make a device go away after it has
  been pulled.  (This is especially true for busses/controllers, like
  parallel SCSI controllers, that don't automatically detect changes
  in topology.)  Opening a device that is no longer there to
  determine the bus/target/lun might result in error recovery actions
  when the user really just wanted to make the device go away.
  
  sbin/camcontrol/camcontrol.c:
In dorescan_or_reset(), if the use hasn't specified a
numeric argument, assume he has specified a device.  Lookup
the pass(4) instance for that device using the transport
layer CAMGETPASSTHRU ioctl.  If that is successful, we can
use the returned bus:target:lun to rescan or reset the
device.
  
Under the hood, resetting a device using XPT_RESET_DEV is
actually sent via the pass(4) device anyway.  But this
provides a way for the user to specify devices in a more
convenient way, and can work on device rescans when the
device is going away, assuming it still exists in the EDT.
  
  sbin/camcontrol/camcontrol.8:
Update the man page for the rescan and reset subcommands
to reflect that you can now use a device name and unit
number with them.
  
  Sponsored by: Spectra Logic
  MFC after:3 days

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Wed May  3 20:56:54 2017
(r317773)
+++ head/sbin/camcontrol/camcontrol.8   Wed May  3 20:57:52 2017
(r317774)
@@ -102,10 +102,10 @@
 .Op device id
 .Nm
 .Ic rescan
-.Aq all | bus Ns Op :target:lun
+.Aq all | device id | bus Ns Op :target:lun
 .Nm
 .Ic reset
-.Aq all | bus Ns Op :target:lun
+.Aq all | device id | bus Ns Op :target:lun
 .Nm
 .Ic defects
 .Op device id
@@ -578,12 +578,20 @@ start bit cleared and the load/eject bit
 .It Ic rescan
 Tell the kernel to scan all buses in the system (with the
 .Ar all
-argument), the given bus (XPT_SCAN_BUS), or bus:target:lun
+argument), the given bus (XPT_SCAN_BUS), bus:target:lun or device
 (XPT_SCAN_LUN) for new devices or devices that have gone away.
 The user
 may specify a scan of all buses, a single bus, or a lun.
 Scanning all luns
 on a target is not supported.
+.Pp
+If a device is specified by peripheral name and unit number, for instance
+da4, it may only be rescanned if that device currently exists in the CAM EDT
+(Existing Device Table).
+If the device is no longer there (see
+.Nm
+devlist ),
+you must use the bus:target:lun form to rescan it.
 .It Ic reprobe
 Tell the kernel to refresh the information about the device and
 notify the upper layer,
@@ -593,8 +601,8 @@ the disk size visible to the rest of the
 .It Ic reset
 Tell the kernel to reset all buses in the system (with the
 .Ar all
-argument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus
-reset for that bus, or to reset the given bus:target:lun
+argument), the given bus (XPT_RESET_BUS) by issuing a SCSI bus
+reset for that bus, or to reset the given bus:target:lun or device
 (XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
 connecting to that device.
 Note that this can have a destructive impact

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Wed May  3 20:56:54 2017
(r317773)
+++ head/sbin/camcontrol/camcontrol.c   Wed May  3 20:57:52 2017
(r317774)
@@ -3131,12 +3131,107 @@ dorescan_or_reset(int argc, char **argv,
tstr++;
if (strncasecmp(tstr, "all", strlen("all")) == 0)
arglist |= CAM_ARG_BUS;
-   else {
+   else if (isdigit(*tstr)) {
rv = parse_btl(argv[optind], , , , );
if (rv != 1 && rv != 3) {
warnx(must, rescan? "rescan" : "reset");
return(1);
}
+

svn commit: r317745 - head/sys/cam/scsi

2017-05-03 Thread Kenneth D. Merry
Author: ken
Date: Wed May  3 14:53:27 2017
New Revision: 317745
URL: https://svnweb.freebsd.org/changeset/base/317745

Log:
  Don't bother retrying errors for encrypted drives that are locked.
  
  sys/cam/scsi/scsi_all.c:
In the asc_table, if we get a 0x20,0x02 error ("Access denied -
no access rights"), don't bother retrying.  Instead, immediately
fail the command.
  
This is the error returned by Self Encrypting Drives (SED) when
they are locked.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/scsi/scsi_all.c

Modified: head/sys/cam/scsi/scsi_all.c
==
--- head/sys/cam/scsi/scsi_all.cWed May  3 14:21:18 2017
(r317744)
+++ head/sys/cam/scsi/scsi_all.cWed May  3 14:53:27 2017
(r317745)
@@ -1614,7 +1614,7 @@ static struct asc_table_entry asc_table[
{ SST(0x20, 0x01, SS_RDEF,  /* XXX TBD */
"Access denied - initiator pending-enrolled") },
/* DT PWROMAEBK   */
-   { SST(0x20, 0x02, SS_RDEF,  /* XXX TBD */
+   { SST(0x20, 0x02, SS_FATAL | EPERM,
"Access denied - no access rights") },
/* DT PWROMAEBK   */
{ SST(0x20, 0x03, SS_RDEF,  /* XXX TBD */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317740 - head/sys/dev/isp

2017-05-03 Thread Kenneth D. Merry
Author: ken
Date: Wed May  3 13:17:01 2017
New Revision: 317740
URL: https://svnweb.freebsd.org/changeset/base/317740

Log:
  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

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/ispmbox.h
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Wed May  3 12:26:16 2017(r317739)
+++ head/sys/dev/isp/isp.c  Wed May  3 13:17:01 2017(r317740)
@@ -2771,10 +2771,11 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui
pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits);
ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8);
ISP_MEMCPY(pdb->nodename, un.bill.pdb_nodename, 8);
-   isp_prt(isp, ISP_LOGDEBUG1,
-   "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x",
+   isp_prt(isp, ISP_LOGDEBUG0,
+   "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x 
laststate %x",
chan, id, pdb->portid, un.bill.pdb_flags,
-   un.bill.pdb_curstate);
+   un.bill.pdb_curstate, un.bill.pdb_laststate);
+
if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || 
un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) {
mbs.param[0] = MBOX_NOT_LOGGED_IN;
return (mbs.param[0]);

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Wed May  3 12:26:16 2017
(r317739)
+++ head/sys/dev/isp/isp_freebsd.c  Wed May  3 13:17:01 2017
(r317740)
@@ -2567,8 +2567,7 @@ isp_watchdog(void *arg)
} 
isp_destroy_handle(isp, handle);
isp_prt(isp, ISP_LOGERR, "%s: timeout for handle 0x%x", 
__func__, handle);
-   xs->ccb_h.status &= ~CAM_STATUS_MASK;
-   xs->ccb_h.status |= 

svn commit: r317680 - head/sys/cam/scsi

2017-05-02 Thread Kenneth D. Merry
Author: ken
Date: Tue May  2 14:52:28 2017
New Revision: 317680
URL: https://svnweb.freebsd.org/changeset/base/317680

Log:
  Add the SCSI SSC Manufacturer assigned serial number VPD page.
  
  This is current as of SSC-5r03.
  
  Submitted by: Sam Klopsch
  MFC after:3 days

Modified:
  head/sys/cam/scsi/scsi_sa.h

Modified: head/sys/cam/scsi/scsi_sa.h
==
--- head/sys/cam/scsi/scsi_sa.h Tue May  2 13:47:15 2017(r317679)
+++ head/sys/cam/scsi/scsi_sa.h Tue May  2 14:52:28 2017(r317680)
@@ -487,6 +487,19 @@ struct scsi_medium_type_data {
 };
 
 /*
+ * Manufacturer-assigned Serial Number VPD page.
+ * Current as of SSC-5r03, 28 September 2016.
+ */
+struct scsi_vpd_mfg_serial_number
+{
+   u_int8_t device;
+   u_int8_t page_code;
+#defineSVPD_MFG_SERIAL_NUMBER_PAGE_CODE 0xB1
+   u_int8_t page_length[2];
+   u_int8_t mfg_serial_num[];
+};
+
+/*
  * Security Protocol Specific values for the Tape Data Encryption protocol
  * (0x20) used with SECURITY PROTOCOL IN.  See below for values used with
  * SECURITY PROTOCOL OUT.  Current as of SSC4r03.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317657 - head/sbin/camcontrol

2017-05-01 Thread Kenneth D. Merry
Author: ken
Date: Mon May  1 18:53:47 2017
New Revision: 317657
URL: https://svnweb.freebsd.org/changeset/base/317657

Log:
  Fix camcontrol timestamp setting and update the man page.
  
  camcontrol timestamp -s would somtimes fail due to stack garbage.  Zero out
  the timestamp parameters to fix it.
  
  Fix another nearby bug, and update the man page.
  
  sbin/camcontrol/timestamp.c:
In set_timestamp(), bzero ts_p prior to creating the timestamp.
Previously stack garbage could cause some tape drives to reject the
timestamp.
  
In set_timestamp(), check for failures from strptime().
  
  sbin/camcontrol/camcontrol.8:
Add the time argument to the -T option to camcontrol timestamp -s
in the long description.
  
Change the time/date format used in the camcontrol timestamp
example to RFC 2822 format.  This fixes a time zone issue with the
original example by specifying the time zone as -0600.  Otherwise,
the time zone seems to default to standard time in the current
locale, which makes the time, when reported back from the drive,
1 hour off from the intended setting.  This also fixes a duplicate
day of the week ("Wednesday Wed") in the previous example.
  
  Submitted by: Sam Klopsch
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/timestamp.c

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Mon May  1 17:10:43 2017
(r317656)
+++ head/sbin/camcontrol/camcontrol.8   Mon May  1 18:53:47 2017
(r317657)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 17, 2017
+.Dd May 1, 2017
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -2488,7 +2488,7 @@ Specify the strptime format string, as d
 The time must also be specified with the
 .Fl T 
 option.
-.It Fl T
+.It Fl T Ar time
 Provide the time in the format specified with the
 .Fl f
 option.
@@ -2814,8 +2814,8 @@ drive
 .Pa ada0 .
 .Pp
 .Bd -literal -offset indent
-camcontrol timestamp sa0 -s -f "%A %c" \e
-   -T "Wednesday Wed Oct 26 21:43:57 2016"
+camcontrol timestamp sa0 -s -f "%a, %d %b %Y %T %z" \e
+   -T "Wed, 26 Oct 2016 21:43:57 -0600"
 .Ed
 .Pp
 Set the timestamp of drive

Modified: head/sbin/camcontrol/timestamp.c
==
--- head/sbin/camcontrol/timestamp.cMon May  1 17:10:43 2017
(r317656)
+++ head/sbin/camcontrol/timestamp.cMon May  1 18:53:47 2017
(r317657)
@@ -282,12 +282,18 @@ set_timestamp(struct cam_device *device,
ts = (uint64_t) time_value;
} else {
bzero(_struct, sizeof(struct tm));
-   strptime(timestamp_string, format_string, _struct);
+   if (strptime(timestamp_string, format_string,
+   _struct) == NULL) {
+   warnx("%s: strptime(3) failed", __func__);
+   error = 1;
+   goto bailout;
+   }
time_value = mktime(_struct);
ts = (uint64_t) time_value;
}
/* Convert time from seconds to milliseconds */
ts *= 1000;
+   bzero(_p, sizeof(ts_p));
scsi_create_timestamp(ts_p.timestamp, ts);
 
scsi_set_timestamp(>csio,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314221 - stable/10/sbin/camcontrol

2017-02-24 Thread Kenneth D. Merry
Author: ken
Date: Fri Feb 24 20:51:39 2017
New Revision: 314221
URL: https://svnweb.freebsd.org/changeset/base/314221

Log:
  MFC r313893
  

r313893 | ken | 2017-02-17 13:04:22 -0700 (Fri, 17 Feb 2017) | 48 lines
  
Add task attribute support to camcontrol(8).
  
Users can use the new generic argument, -Q task_attr, to specify a task
attribute (simple, ordered, head of queue, aca) for the commands issued.
The the default is simple, which works with all SCSI devices that support
tagged queueing.
  
This will mostly be useful for debugging target behavior in certain
situations.
  
You can try it out by compiling CTL with CTL_IO_DELAY turned on (in
sys/cam/ctl/ctl_io.h) and then do something like this with one of the CTL
LUNs:
  
ctladm delay 0:0 -l done -t 10
camcontrol tur da34 -v
  
And at then before the 10 second timer is up, in another terminal:
  
camcontrol inquiry da34 -Q ordered -v
  
The Inquiry should complete just after the TUR completes.  Ordinarily
it would complete first because of the delay injection, but because the
task attribute is set to ordered in this case, CTL holds it up until the
previous command has completed.
  
sbin/camcontrol/camcontrol.c:
Add the new generic argument, -Q, which allows the user to specify
a SCSI task attribute.  The user can specify task attributes by
name or numerically.
  
Add a new task_attr arguments to SCSI sub-functions.
  
sbin/camcontrol/attrib.c,
sbin/camcontrol/camcontrol.h,
sbin/camcontrol/fwdownload.c,
sbin/camcontrol/modeedit.c,
sbin/camcontrol/persist.c,
sbin/camcontrol/timestamp.c,
sbin/camcontrol/zone.c:
Add the new task_attr argument to SCSI sub-functions.
  
sbin/camcontrol/camcontrol.8:
Document the new -Q option, and add an example.
  
Sponsored by:   Spectra Logic
  


Modified:
  stable/10/sbin/camcontrol/attrib.c
  stable/10/sbin/camcontrol/camcontrol.8
  stable/10/sbin/camcontrol/camcontrol.c
  stable/10/sbin/camcontrol/camcontrol.h
  stable/10/sbin/camcontrol/fwdownload.c
  stable/10/sbin/camcontrol/modeedit.c
  stable/10/sbin/camcontrol/persist.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/camcontrol/attrib.c
==
--- stable/10/sbin/camcontrol/attrib.c  Fri Feb 24 20:47:56 2017
(r314220)
+++ stable/10/sbin/camcontrol/attrib.c  Fri Feb 24 20:51:39 2017
(r314221)
@@ -106,7 +106,8 @@ static struct scsi_nv output_format_map[
 
 int
 scsiattrib(struct cam_device *device, int argc, char **argv, char *combinedopt,
-  int retry_count, int timeout, int verbosemode, int err_recover)
+  int task_attr, int retry_count, int timeout, int verbosemode,
+  int err_recover)
 {
union ccb *ccb = NULL;
int attr_num = -1;
@@ -317,7 +318,7 @@ scsiattrib(struct cam_device *device, in
scsi_read_attribute(>csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
-   /*tag_action*/ MSG_SIMPLE_Q_TAG,
+   /*tag_action*/ task_attr,
/*service_action*/ read_service_action,
/*element*/ element_address,
/*elem_type*/ element_type,

Modified: stable/10/sbin/camcontrol/camcontrol.8
==
--- stable/10/sbin/camcontrol/camcontrol.8  Fri Feb 24 20:47:56 2017
(r314220)
+++ stable/10/sbin/camcontrol/camcontrol.8  Fri Feb 24 20:51:39 2017
(r314221)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 6, 2017
+.Dd February 17, 2017
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -397,6 +397,17 @@ It may take some other actions, dependin
 the command.
 .It Fl n Ar dev_name
 Specify the device type to operate on, e.g.\& "da", "cd".
+.It Fl Q Ar task_attr
+.Tn SCSI
+task attribute for the command, if it is a
+.Tn SCSI
+command.
+This may be ordered, simple, head, or aca.
+In most cases this is not needed.
+The default is simple, which works with all
+.Tn SCSI
+devices.
+The task attribute may also be specified numerically.
 .It Fl t Ar timeout
 SCSI command timeout in seconds.
 This overrides the default timeout for
@@ -2143,7 +2154,7 @@ information if the command fails since t
 .Fl v
 switch was not specified.
 .Bd -literal -offset indent
-camcontrol tur da1 -E -C 4 -t 50 -v
+camcontrol tur da1 -E -C 4 -t 50 -Q head -v
 .Ed
 .Pp
 Send a test unit ready command to da1.
@@ -2156,6 +2167,9 @@ flag) if the command fails.
 Since error recovery is turned on, the
 disk will be 

svn commit: r314220 - stable/11/sbin/camcontrol

2017-02-24 Thread Kenneth D. Merry
Author: ken
Date: Fri Feb 24 20:47:56 2017
New Revision: 314220
URL: https://svnweb.freebsd.org/changeset/base/314220

Log:
  MFC r313893
  

r313893 | ken | 2017-02-17 13:04:22 -0700 (Fri, 17 Feb 2017) | 48 lines
  
Add task attribute support to camcontrol(8).
  
Users can use the new generic argument, -Q task_attr, to specify a task
attribute (simple, ordered, head of queue, aca) for the commands issued.
The the default is simple, which works with all SCSI devices that support
tagged queueing.
  
This will mostly be useful for debugging target behavior in certain
situations.
  
You can try it out by compiling CTL with CTL_IO_DELAY turned on (in
sys/cam/ctl/ctl_io.h) and then do something like this with one of the CTL
LUNs:
  
ctladm delay 0:0 -l done -t 10
camcontrol tur da34 -v
  
And at then before the 10 second timer is up, in another terminal:
  
camcontrol inquiry da34 -Q ordered -v
  
The Inquiry should complete just after the TUR completes.  Ordinarily
it would complete first because of the delay injection, but because the
task attribute is set to ordered in this case, CTL holds it up until the
previous command has completed.
  
sbin/camcontrol/camcontrol.c:
Add the new generic argument, -Q, which allows the user to specify
a SCSI task attribute.  The user can specify task attributes by
name or numerically.
  
Add a new task_attr arguments to SCSI sub-functions.
  
sbin/camcontrol/attrib.c,
sbin/camcontrol/camcontrol.h,
sbin/camcontrol/fwdownload.c,
sbin/camcontrol/modeedit.c,
sbin/camcontrol/persist.c,
sbin/camcontrol/timestamp.c,
sbin/camcontrol/zone.c:
Add the new task_attr argument to SCSI sub-functions.
  
sbin/camcontrol/camcontrol.8:
Document the new -Q option, and add an example.
  
Sponsored by:   Spectra Logic
  


Modified:
  stable/11/sbin/camcontrol/attrib.c
  stable/11/sbin/camcontrol/camcontrol.8
  stable/11/sbin/camcontrol/camcontrol.c
  stable/11/sbin/camcontrol/camcontrol.h
  stable/11/sbin/camcontrol/fwdownload.c
  stable/11/sbin/camcontrol/modeedit.c
  stable/11/sbin/camcontrol/persist.c
  stable/11/sbin/camcontrol/timestamp.c
  stable/11/sbin/camcontrol/zone.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/camcontrol/attrib.c
==
--- stable/11/sbin/camcontrol/attrib.c  Fri Feb 24 20:04:02 2017
(r314219)
+++ stable/11/sbin/camcontrol/attrib.c  Fri Feb 24 20:47:56 2017
(r314220)
@@ -106,7 +106,8 @@ static struct scsi_nv output_format_map[
 
 int
 scsiattrib(struct cam_device *device, int argc, char **argv, char *combinedopt,
-  int retry_count, int timeout, int verbosemode, int err_recover)
+  int task_attr, int retry_count, int timeout, int verbosemode,
+  int err_recover)
 {
union ccb *ccb = NULL;
int attr_num = -1;
@@ -317,7 +318,7 @@ scsiattrib(struct cam_device *device, in
scsi_read_attribute(>csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
-   /*tag_action*/ MSG_SIMPLE_Q_TAG,
+   /*tag_action*/ task_attr,
/*service_action*/ read_service_action,
/*element*/ element_address,
/*elem_type*/ element_type,

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Fri Feb 24 20:04:02 2017
(r314219)
+++ stable/11/sbin/camcontrol/camcontrol.8  Fri Feb 24 20:47:56 2017
(r314220)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 6, 2017
+.Dd February 17, 2017
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -422,6 +422,17 @@ It may take some other actions, dependin
 the command.
 .It Fl n Ar dev_name
 Specify the device type to operate on, e.g.\& "da", "cd".
+.It Fl Q Ar task_attr
+.Tn SCSI
+task attribute for the command, if it is a
+.Tn SCSI
+command.
+This may be ordered, simple, head, or aca.
+In most cases this is not needed.
+The default is simple, which works with all
+.Tn SCSI
+devices.
+The task attribute may also be specified numerically.
 .It Fl t Ar timeout
 SCSI command timeout in seconds.
 This overrides the default timeout for
@@ -2509,7 +2520,7 @@ information if the command fails since t
 .Fl v
 switch was not specified.
 .Bd -literal -offset indent
-camcontrol tur da1 -E -C 4 -t 50 -v
+camcontrol tur da1 -E -C 4 -t 50 -Q head -v
 .Ed
 .Pp
 Send a test unit ready command to da1.
@@ -2522,6 +2533,9 @@ flag) if 

svn commit: r313998 - stable/10/sys/cam/ctl

2017-02-20 Thread Kenneth D. Merry
Author: ken
Date: Mon Feb 20 20:16:11 2017
New Revision: 313998
URL: https://svnweb.freebsd.org/changeset/base/313998

Log:
  MFC 313895:
  

r313895 | ken | 2017-02-17 13:15:27 -0700 (Fri, 17 Feb 2017) | 9 lines
  
Make ctl(4) build with CTL_IO_DELAY defined.
  
sys/cam/ctl/ctl.c:
In ctl_datamove(), inside CTL_IO_DELAY, add a lun variable and fill
it in before trying to dereference it.
  
Sponsored by:   Spectra Logic
  


Modified:
  stable/10/sys/cam/ctl/ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Mon Feb 20 20:12:02 2017(r313997)
+++ stable/10/sys/cam/ctl/ctl.c Mon Feb 20 20:16:11 2017(r313998)
@@ -12393,6 +12393,9 @@ ctl_datamove(union ctl_io *io)
if (io->io_hdr.flags & CTL_FLAG_DELAY_DONE) {
io->io_hdr.flags &= ~CTL_FLAG_DELAY_DONE;
} else {
+   struct ctl_lun *lun;
+
+   lun = CTL_LUN(io);
if ((lun != NULL)
 && (lun->delay_info.datamove_delay > 0)) {
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


  1   2   3   4   5   >