svn commit: r265485 - head/sys/dev/mpr

2014-05-06 Thread Kenneth D. Merry
Author: ken
Date: Wed May  7 05:14:48 2014
New Revision: 265485
URL: http://svnweb.freebsd.org/changeset/base/265485

Log:
  Hold the SIM lock when calling xpt_create_path() and xpt_action() in
  mprsas_SSU_to_SATA_devices().
  
  This fixes an assertion on shutdown with INVARIANTS enabled with SATA
  drives present on an IR firmware controller.
  
  Reviewed by:  Steve McConnell .
  MFC after:3 days

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

Modified: head/sys/dev/mpr/mpr_sas_lsi.c
==
--- head/sys/dev/mpr/mpr_sas_lsi.c  Wed May  7 05:11:16 2014
(r265484)
+++ head/sys/dev/mpr/mpr_sas_lsi.c  Wed May  7 05:14:48 2014
(r265485)
@@ -1026,6 +1026,8 @@ mprsas_SSU_to_SATA_devices(struct mpr_so
char path_str[64];
struct timeval cur_time, start_time;
 
+   mpr_lock(sc);
+
/*
 * For each LUN of each target, issue a StartStopUnit command to stop
 * the device.
@@ -1041,6 +1043,7 @@ mprsas_SSU_to_SATA_devices(struct mpr_so
SLIST_FOREACH(lun, &target->luns, lun_link) {
ccb = xpt_alloc_ccb_nowait();
if (ccb == NULL) {
+   mpr_unlock(sc);
mpr_dprint(sc, MPR_FAULT, "Unable to alloc "
"CCB to stop unit.\n");
return;
@@ -1057,6 +1060,7 @@ mprsas_SSU_to_SATA_devices(struct mpr_so
mpr_dprint(sc, MPR_FAULT, "Unable to "
"create LUN path to stop unit.\n");
xpt_free_ccb(ccb);
+   mpr_unlock(sc);
return;
}
xpt_path_string(ccb->ccb_h.path, path_str,
@@ -1092,6 +1096,8 @@ mprsas_SSU_to_SATA_devices(struct mpr_so
}
}
 
+   mpr_unlock(sc);
+
/*
 * Wait until all of the SSU commands have completed or time has
 * expired (60 seconds).  pause for 100ms each time through.  If any
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r265584 - svnadmin/conf

2014-05-07 Thread Kenneth D. Merry
Author: ken
Date: Wed May  7 18:22:30 2014
New Revision: 265584
URL: http://svnweb.freebsd.org/changeset/base/265584

Log:
  Add Steve McConnell (slm) as a src committer.
  
  Steve works for LSI (which is now Avago) and will be maintaing drivers for
  LSI's SAS and RAID products (mps(4), mpr(4), mrsas(4)).
  
  scottl, ambrisko and ken will be his mentors.
  
  Approved by:  core

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

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessWed May  7 18:21:38 2014(r265583)
+++ svnadmin/conf/accessWed May  7 18:22:30 2014(r265584)
@@ -197,6 +197,7 @@ se
 silby
 simon
 sjg
+slm
 smh
 sobomax
 stas

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Wed May  7 18:21:38 2014(r265583)
+++ svnadmin/conf/mentors   Wed May  7 18:22:30 2014(r265584)
@@ -28,6 +28,7 @@ monthadar adrian
 odeds  jhb Co-mentor: alfred
 peterj jhb Co-mentor: grog
 royger gibbs
+slmken Co-mentor: scottl, ambrisko
 snbdwmalone
 tychon neelCo-mentor: grehan
 versus gavin   Co-mentor: fjoe
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2014-05-08 Thread Kenneth D. Merry
Author: ken
Date: Thu May  8 20:28:22 2014
New Revision: 265709
URL: http://svnweb.freebsd.org/changeset/base/265709

Log:
  Fix TLR (Transport Layer Retry) support in the mps(4) and mpr(4) drivers.
  
  TLR is necessary for reliable communication with SAS tape drives.
  
  This was broken by change 246713 in the mps(4) driver.  It changed the
  cm_data field for SCSI I/O requests to point to the CCB instead of the data
  buffer.  So, instead, look at the CCB's data pointer to determine whether
  or not we're talking to a tape drive.
  
  Also, take the residual into account to make sure that we don't go off the
  end of the request.
  
  MFC after:3 days
  Sponsored by: Spectra Logic Corporation

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  Thu May  8 20:27:06 2014(r265708)
+++ head/sys/dev/mpr/mpr_sas.c  Thu May  8 20:28:22 2014(r265709)
@@ -2355,8 +2355,9 @@ mprsas_scsiio_complete(struct mpr_softc 
(csio->cdb_io.cdb_bytes[1] & SI_EVPD) &&
(csio->cdb_io.cdb_bytes[2] == SVPD_SUPPORTED_PAGE_LIST) &&
((csio->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR) &&
-   (csio->data_ptr != NULL) && (((uint8_t *)cm->cm_data)[0] ==
-   T_SEQUENTIAL) && (sc->control_TLR) &&
+   (csio->data_ptr != NULL) &&
+   ((csio->data_ptr[0] & 0x1f) == T_SEQUENTIAL) &&
+   (sc->control_TLR) &&
(sc->mapping_table[csio->ccb_h.target_id].device_info &
MPI2_SAS_DEVICE_INFO_SSP_TARGET)) {
vpd_list = (struct scsi_vpd_supported_page_list *)
@@ -2367,6 +2368,7 @@ mprsas_scsiio_complete(struct mpr_softc 
TLR_on = (u8)MPI2_SCSIIO_CONTROL_TLR_ON;
alloc_len = ((u16)csio->cdb_io.cdb_bytes[3] << 8) +
csio->cdb_io.cdb_bytes[4];
+   alloc_len -= csio->resid;
for (i = 0; i < MIN(vpd_list->length, alloc_len); i++) {
if (vpd_list->list[i] == 0x90) {
*TLR_bits = TLR_on;

Modified: head/sys/dev/mps/mps_sas.c
==
--- head/sys/dev/mps/mps_sas.c  Thu May  8 20:27:06 2014(r265708)
+++ head/sys/dev/mps/mps_sas.c  Thu May  8 20:28:22 2014(r265709)
@@ -2316,8 +2316,9 @@ mpssas_scsiio_complete(struct mps_softc 
(csio->cdb_io.cdb_bytes[1] & SI_EVPD) &&
(csio->cdb_io.cdb_bytes[2] == SVPD_SUPPORTED_PAGE_LIST) &&
((csio->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR) &&
-   (csio->data_ptr != NULL) && (((uint8_t *)cm->cm_data)[0] ==
-   T_SEQUENTIAL) && (sc->control_TLR) &&
+   (csio->data_ptr != NULL) &&
+   ((csio->data_ptr[0] & 0x1f) == T_SEQUENTIAL) &&
+   (sc->control_TLR) &&
(sc->mapping_table[csio->ccb_h.target_id].device_info &
MPI2_SAS_DEVICE_INFO_SSP_TARGET)) {
vpd_list = (struct scsi_vpd_supported_page_list *)
@@ -2328,6 +2329,7 @@ mpssas_scsiio_complete(struct mps_softc 
TLR_on = (u8)MPI2_SCSIIO_CONTROL_TLR_ON;
alloc_len = ((u16)csio->cdb_io.cdb_bytes[3] << 8) +
csio->cdb_io.cdb_bytes[4];
+   alloc_len -= csio->resid;
for (i = 0; i < MIN(vpd_list->length, alloc_len); i++) {
if (vpd_list->list[i] == 0x90) {
*TLR_bits = TLR_on;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r265712 - head/sys/dev/mpr

2014-05-08 Thread Kenneth D. Merry
Author: ken
Date: Thu May  8 20:46:46 2014
New Revision: 265712
URL: http://svnweb.freebsd.org/changeset/base/265712

Log:
  Add #ifdefs in the mpr(4) driver so that versions of stable/9 that
  have implemented the PIM_NOSCAN rescan functionality will have it
  enabled.
  
  This is a no-op for head.
  
  Reviewed by:  slm
  Sponsored by: Spectra Logic Corporation
  MFC after:3 days

Modified:
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mpr/mpr_sas_lsi.c

Modified: head/sys/dev/mpr/mpr_sas.c
==
--- head/sys/dev/mpr/mpr_sas.c  Thu May  8 20:41:39 2014(r265711)
+++ head/sys/dev/mpr/mpr_sas.c  Thu May  8 20:46:46 2014(r265712)
@@ -183,7 +183,8 @@ mprsas_startup_increment(struct mprsas_s
/* just starting, freeze the simq */
mpr_dprint(sassc->sc, MPR_INIT,
"%s freezing simq\n", __func__);
-#if __FreeBSD_version >= 139
+#if (__FreeBSD_version >= 139) || \
+((__FreeBSD_version < 100) && (__FreeBSD_version >= 902502))
xpt_hold_boot();
 #endif
xpt_freeze_simq(sassc->sim, 1);
@@ -217,7 +218,8 @@ mprsas_startup_decrement(struct mprsas_s
"%s releasing simq\n", __func__);
sassc->flags &= ~MPRSAS_IN_STARTUP;
xpt_release_simq(sassc->sim, 1);
-#if __FreeBSD_version >= 139
+#if (__FreeBSD_version >= 139) || \
+((__FreeBSD_version < 100) && (__FreeBSD_version >= 902502))
xpt_release_boot();
 #else
mprsas_rescan_target(sassc->sc, NULL);
@@ -974,7 +976,8 @@ mprsas_action(struct cam_sim *sim, union
cpi->version_num = 1;
cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16;
cpi->target_sprt = 0;
-#if __FreeBSD_version >= 139
+#if (__FreeBSD_version >= 139) || \
+((__FreeBSD_version < 100) && (__FreeBSD_version >= 902502))
cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED | PIM_NOSCAN;
 #else
cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED;

Modified: head/sys/dev/mpr/mpr_sas_lsi.c
==
--- head/sys/dev/mpr/mpr_sas_lsi.c  Thu May  8 20:41:39 2014
(r265711)
+++ head/sys/dev/mpr/mpr_sas_lsi.c  Thu May  8 20:46:46 2014
(r265712)
@@ -801,7 +801,8 @@ mprsas_add_device(struct mpr_softc *sc, 
"and connector name (%4s)\n", targ->encl_level,
targ->connector_name);
}
-#if __FreeBSD_version < 139
+#if ((__FreeBSD_version >= 100) && (__FreeBSD_version < 139)) || \
+(__FreeBSD_version < 902502)
if ((sassc->flags & MPRSAS_IN_STARTUP) == 0)
 #endif
mprsas_rescan_target(sc, targ);
@@ -992,7 +993,8 @@ mprsas_volume_add(struct mpr_softc *sc, 
free(lun, M_MPR);
}
SLIST_INIT(&targ->luns);
-#if __FreeBSD_version < 139
+#if ((__FreeBSD_version >= 100) && (__FreeBSD_version < 139)) || \
+(__FreeBSD_version < 902502)
if ((sassc->flags & MPRSAS_IN_STARTUP) == 0)
 #endif
mprsas_rescan_target(sc, targ);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r265729 - in stable/9: share/man/man4 sys/amd64/conf sys/conf sys/dev/mpr sys/i386/conf sys/ia64/conf sys/mips/conf sys/modules sys/modules/mpr sys/sparc64/conf

2014-05-08 Thread Kenneth D. Merry
Author: ken
Date: Fri May  9 03:52:10 2014
New Revision: 265729
URL: http://svnweb.freebsd.org/changeset/base/265729

Log:
  MFC the mpr(4) driver for LSI's 12Gb SAS cards.
  
  This includes r265236, r265237, r265241, r265261, r265386, r265424, and
  r265473.
  

r265236 | ken | 2014-05-02 14:25:09 -0600 (Fri, 02 May 2014) | 51 lines
  
Bring in the mpr(4) driver for LSI's MPT3 12Gb SAS controllers.
  
This is derived from the mps(4) driver, but it supports only the 12Gb
IT and IR hardware including the SAS 3004, SAS 3008 and SAS 3108.
  
Some notes about this driver:
 o The 12Gb hardware can do "FastPath" I/O, and that capability is included 
in
   this driver.
  
 o WarpDrive functionality has been removed, since it isn't supported in
   the 12Gb driver interface.
  
 o The Scatter/Gather list handling code is significantly different between
   the 6Gb and 12Gb hardware.  The 12Gb boards support IEEE Scatter/Gather
   lists.
  
Thanks to LSI for developing and testing this driver for FreeBSD.
  
share/man/man4/mpr.4:
mpr(4) man page.
  
sys/dev/mpr/*:
mpr(4) driver files.
  
sys/modules/Makefile,
sys/modules/mpr/Makefile:
Add a module Makefile for the mpr(4) driver.
  
sys/conf/files:
Add the mpr(4) driver.
  
sys/amd64/conf/GENERIC,
sys/i386/conf/GENERIC,
sys/mips/conf/OCTEON1,
sys/sparc64/conf/GENERIC:
Add the mpr(4) driver to all config files that currently
have the mps(4) driver.
  
sys/ia64/conf/GENERIC:
Add the mps(4) and mpr(4) drivers to the ia64 GENERIC
config file.
  
sys/i386/conf/XEN:
Exclude the mpr module from building here.
  
Submitted by:   Steve McConnell 
Tested by:  Chris Reeves 
Sponsored by:   LSI, Spectra Logic
Relnotes:   LSI 12Gb SAS driver mpr(4) added
  


r265237 | ken | 2014-05-02 14:36:20 -0600 (Fri, 02 May 2014) | 8 lines
  
Add the mpr(4) man page to the man4 Makefile.
  
This should have been included in r265236.
  
Submitted by:   Steve McConnell 
Sponsored by:   LSI, Spectra Logic
  


r265241 | brueffer | 2014-05-02 15:14:28 -0600 (Fri, 02 May 2014) | 2 lines
  
Use our standard SYNOPSIS wording; perform some cleanup while here.
  


r265261 | brueffer | 2014-05-03 05:15:28 -0600 (Sat, 03 May 2014) | 2 lines
  
Add a missing colon.
  


r265386 | ken | 2014-05-05 13:53:03 -0600 (Mon, 05 May 2014) | 15 lines
  
Adjust #if statements inside mprsas_send_smpcmd() to more accurately
reflect when unmapped I/O support was added.
  
For FreeBSD 10, it arrived just prior to __FreeBSD_version 128.
For FreeBSD 9, it arrived just prior to __FreeBSD_version 902001.
  
Also, fix compiler warnings in mprsas_send_smpcmd() that happen in the
i386 PAE build for non-unmapped I/O builds.  These were fixed in mps(4)
in revision 241145, but didn't make it into the mpr(4) driver.  This
change should only affect FreeBSD versions outside the above revisions,
and thus doesn't affect head.
  
Sponsored by:   Spectra Logic Corporation
  


r265424 | ken | 2014-05-06 00:18:43 -0600 (Tue, 06 May 2014) | 33 lines
  
Fix a problem with async notifications in the mpr(4) driver.
  
This problem only occurs on versions of FreeBSD prior to the recent CAM
locking changes.  (i.e. stable/9 and older versions of stable/10)  This
change should be a no-op for head and stable/10.
  
If a path isn't specified, xpt_register_async() will create a fully
wildcarded path and acquire a lock (the XPT lock in older versions,
and via xpt_path_lock() in newer versions) to call xpt_action() for the
XPT_SASYNC_CB CCB.  It will then drop the lock and if the requested event
includes AC_FOUND_DEVICE or AC_PATH_REGISTERED, it will get the caller up
to date with any device arrivals or path registrations.
  
The issue is that before the locking changes, each SIM lock would get
acquired in turn during the EDT tree traversal process.  If a path is
specified for xpt_register

svn commit: r265730 - stable/10/sys/dev/mpr

2014-05-08 Thread Kenneth D. Merry
Author: ken
Date: Fri May  9 03:59:12 2014
New Revision: 265730
URL: http://svnweb.freebsd.org/changeset/base/265730

Log:
  MFC mpr(4) driver changes.
  
  This includes r265386, r265424, and r265473.
  

r265386 | ken | 2014-05-05 13:53:03 -0600 (Mon, 05 May 2014) | 15 lines
  
Adjust #if statements inside mprsas_send_smpcmd() to more accurately
reflect when unmapped I/O support was added.
  
For FreeBSD 10, it arrived just prior to __FreeBSD_version 128.
For FreeBSD 9, it arrived just prior to __FreeBSD_version 902001.
  
Also, fix compiler warnings in mprsas_send_smpcmd() that happen in the
i386 PAE build for non-unmapped I/O builds.  These were fixed in mps(4)
in revision 241145, but didn't make it into the mpr(4) driver.  This
change should only affect FreeBSD versions outside the above revisions,
and thus doesn't affect head.
  
Sponsored by:   Spectra Logic Corporation
  


r265424 | ken | 2014-05-06 00:18:43 -0600 (Tue, 06 May 2014) | 33 lines
  
Fix a problem with async notifications in the mpr(4) driver.
  
This problem only occurs on versions of FreeBSD prior to the recent CAM
locking changes.  (i.e. stable/9 and older versions of stable/10)  This
change should be a no-op for head and stable/10.
  
If a path isn't specified, xpt_register_async() will create a fully
wildcarded path and acquire a lock (the XPT lock in older versions,
and via xpt_path_lock() in newer versions) to call xpt_action() for the
XPT_SASYNC_CB CCB.  It will then drop the lock and if the requested event
includes AC_FOUND_DEVICE or AC_PATH_REGISTERED, it will get the caller up
to date with any device arrivals or path registrations.
  
The issue is that before the locking changes, each SIM lock would get
acquired in turn during the EDT tree traversal process.  If a path is
specified for xpt_register_async(), it won't acquire and drop its own lock,
but instead expects the caller to hold its own SIM lock.  That works for
the first part of xpt_register_async(), but causes a recursive lock
acquisition once the EDT traversal happens and it comes to the SIM in
question.  And it isn't possible to call xpt_action() without holding a SIM
lock.
  
The locking changes fix this by using the XPT topology lock for EDT
traversal, so it is no longer an issue to hold the SIM lock while calling
xpt_register_async().
  
The solution for FreeBSD versions before the locking changes is to request
notification of all device arrivals (so we pass a NULL path into
xpt_register_async()) and then filter out the arrivals that are not ours.
  
Sponsored by:   Spectra Logic Corporation
  


r265473 | ken | 2014-05-06 16:13:38 -0600 (Tue, 06 May 2014) | 7 lines
  
Change the device name for mpr(4) from /dev/mpr_N to /dev/mprN.
  
This is more consistent with the existing mps(4) behavior.
  
Reviewed by:Steve McConnell 
  

  
  Sponsored by: LSI, Spectra Logic

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

Modified: stable/10/sys/dev/mpr/mpr_sas.c
==
--- stable/10/sys/dev/mpr/mpr_sas.c Fri May  9 03:52:10 2014
(r265729)
+++ stable/10/sys/dev/mpr/mpr_sas.c Fri May  9 03:59:12 2014
(r265730)
@@ -813,8 +813,49 @@ mpr_attach_sas(struct mpr_softc *sc)
 #else
event = AC_FOUND_DEVICE;
 #endif
+
+   /*
+* Prior to the CAM locking improvements, we can't call
+* xpt_register_async() with a particular path specified.
+*
+* If a path isn't specified, xpt_register_async() will
+* generate a wildcard path and acquire the XPT lock while
+* it calls xpt_action() to execute the XPT_SASYNC_CB CCB.
+* It will then drop the XPT lock once that is done.
+* 
+* If a path is specified for xpt_register_async(), it will
+* not acquire and drop the XPT lock around the call to
+* xpt_action().  xpt_action() asserts that the caller
+* holds the SIM lock, so the SIM lock has to be held when
+* calling xpt_register_async() when the path is specified.
+* 
+* But xpt_register_async calls xpt_for_all_devices(),
+   

Re: svn commit: r265731 - stable/9/release/doc/en_US.ISO8859-1/relnotes

2014-05-08 Thread Kenneth D. Merry
On Fri, May 09, 2014 at 04:08:40 +, Glen Barber wrote:
> Author: gjb
> Date: Fri May  9 04:08:40 2014
> New Revision: 265731
> URL: http://svnweb.freebsd.org/changeset/base/265731
> 
> Log:
>   Document r265729, addition of mpr(4).
>   
>   Sponsored by:   The FreeBSD Foundation

Elapsed time: 16 minutes.

That was fast!

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


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

2014-05-22 Thread Kenneth D. Merry
Author: ken
Date: Thu May 22 16:34:00 2014
New Revision: 266548
URL: http://svnweb.freebsd.org/changeset/base/266548

Log:
  MFC mpr(4) changes: r265484, r265485, r265709 and r265712
  

r265484 | ken | 2014-05-06 23:11:16 -0600 (Tue, 06 May 2014) | 5 lines
  
Remove some debugging code.
  
Submitted by:   Steve McConnell 
  


r265485 | ken | 2014-05-06 23:14:48 -0600 (Tue, 06 May 2014) | 9 lines
  
Hold the SIM lock when calling xpt_create_path() and xpt_action() in
mprsas_SSU_to_SATA_devices().
  
This fixes an assertion on shutdown with INVARIANTS enabled with SATA
drives present on an IR firmware controller.
  
Reviewed by:Steve McConnell .
  


r265709 | ken | 2014-05-08 14:28:22 -0600 (Thu, 08 May 2014) | 15 lines
  
Fix TLR (Transport Layer Retry) support in the mps(4) and mpr(4) drivers.
  
TLR is necessary for reliable communication with SAS tape drives.
  
This was broken by change 246713 in the mps(4) driver.  It changed the
cm_data field for SCSI I/O requests to point to the CCB instead of the data
buffer.  So, instead, look at the CCB's data pointer to determine whether
or not we're talking to a tape drive.
  
Also, take the residual into account to make sure that we don't go off the
end of the request.
  
Sponsored by:   Spectra Logic Corporation
  


r265712 | ken | 2014-05-08 14:46:46 -0600 (Thu, 08 May 2014) | 10 lines
  
Add #ifdefs in the mpr(4) driver so that versions of stable/9 that
have implemented the PIM_NOSCAN rescan functionality will have it
enabled.
  
This is a no-op for head.
  
Reviewed by:slm
Sponsored by:   Spectra Logic Corporation
  

  
  Sponsored by: Spectra Logic, Avago

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

Modified: stable/10/sys/dev/mpr/mpr.c
==
--- stable/10/sys/dev/mpr/mpr.c Thu May 22 16:30:32 2014(r266547)
+++ stable/10/sys/dev/mpr/mpr.c Thu May 22 16:34:00 2014(r266548)
@@ -2182,8 +2182,6 @@ mpr_add_chain(struct mpr_command *cm, in
 * code other than 0.
 */
if (cm->cm_flags & MPR_CM_FLAGS_SGE_SIMPLE) {
-//SLM-test
-printf("Trying to add a chain element to an MPI SGL\n");
mpr_dprint(sc, MPR_ERROR, "A chain element cannot be added to "
"an MPI SGL.\n");
return(ENOBUFS);

Modified: stable/10/sys/dev/mpr/mpr_sas.c
==
--- stable/10/sys/dev/mpr/mpr_sas.c Thu May 22 16:30:32 2014
(r266547)
+++ stable/10/sys/dev/mpr/mpr_sas.c Thu May 22 16:34:00 2014
(r266548)
@@ -183,7 +183,8 @@ mprsas_startup_increment(struct mprsas_s
/* just starting, freeze the simq */
mpr_dprint(sassc->sc, MPR_INIT,
"%s freezing simq\n", __func__);
-#if __FreeBSD_version >= 139
+#if (__FreeBSD_version >= 139) || \
+((__FreeBSD_version < 100) && (__FreeBSD_version >= 902502))
xpt_hold_boot();
 #endif
xpt_freeze_simq(sassc->sim, 1);
@@ -217,7 +218,8 @@ mprsas_startup_decrement(struct mprsas_s
"%s releasing simq\n", __func__);
sassc->flags &= ~MPRSAS_IN_STARTUP;
xpt_release_simq(sassc->sim, 1);
-#if __FreeBSD_version >= 139
+#if (__FreeBSD_version >= 139) || \
+((__FreeBSD_version < 100) && (__FreeBSD_version >= 902502))
xpt_release_boot();
 #else
mprsas_rescan_target(sassc->sc, NULL);
@@ -974,7 +976,8 @@ mprsas_action(struct cam_sim *sim, union
cpi->version_num = 1;
cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16;
cpi->target_sprt = 0;
-#if __FreeBSD_version >= 139
+#if (__FreeBSD_version >= 139) || \
+((__FreeBSD_version < 100) && (__FreeBSD_version >= 902502))
cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED | PIM_NOSCAN;
 #else
cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED;

svn commit: r266549 - in stable/9/sys/dev: mpr mps

2014-05-22 Thread Kenneth D. Merry
Author: ken
Date: Thu May 22 16:36:01 2014
New Revision: 266549
URL: http://svnweb.freebsd.org/changeset/base/266549

Log:
  MFC mpr(4) changes: r265484, r265485, r265709 and r265712
  

r265484 | ken | 2014-05-06 23:11:16 -0600 (Tue, 06 May 2014) | 5 lines
  
Remove some debugging code.
  
Submitted by:   Steve McConnell 
  


r265485 | ken | 2014-05-06 23:14:48 -0600 (Tue, 06 May 2014) | 9 lines
  
Hold the SIM lock when calling xpt_create_path() and xpt_action() in
mprsas_SSU_to_SATA_devices().
  
This fixes an assertion on shutdown with INVARIANTS enabled with SATA
drives present on an IR firmware controller.
  
Reviewed by:Steve McConnell .
  


r265709 | ken | 2014-05-08 14:28:22 -0600 (Thu, 08 May 2014) | 15 lines
  
Fix TLR (Transport Layer Retry) support in the mps(4) and mpr(4) drivers.
  
TLR is necessary for reliable communication with SAS tape drives.
  
This was broken by change 246713 in the mps(4) driver.  It changed the
cm_data field for SCSI I/O requests to point to the CCB instead of the data
buffer.  So, instead, look at the CCB's data pointer to determine whether
or not we're talking to a tape drive.
  
Also, take the residual into account to make sure that we don't go off the
end of the request.
  
Sponsored by:   Spectra Logic Corporation
  


r265712 | ken | 2014-05-08 14:46:46 -0600 (Thu, 08 May 2014) | 10 lines
  
Add #ifdefs in the mpr(4) driver so that versions of stable/9 that
have implemented the PIM_NOSCAN rescan functionality will have it
enabled.
  
This is a no-op for head.
  
Reviewed by:slm
Sponsored by:   Spectra Logic Corporation
  

  
  Sponsored by: Spectra Logic, Avago

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

Modified: stable/9/sys/dev/mpr/mpr.c
==
--- stable/9/sys/dev/mpr/mpr.c  Thu May 22 16:34:00 2014(r266548)
+++ stable/9/sys/dev/mpr/mpr.c  Thu May 22 16:36:01 2014(r266549)
@@ -2182,8 +2182,6 @@ mpr_add_chain(struct mpr_command *cm, in
 * code other than 0.
 */
if (cm->cm_flags & MPR_CM_FLAGS_SGE_SIMPLE) {
-//SLM-test
-printf("Trying to add a chain element to an MPI SGL\n");
mpr_dprint(sc, MPR_ERROR, "A chain element cannot be added to "
"an MPI SGL.\n");
return(ENOBUFS);

Modified: stable/9/sys/dev/mpr/mpr_sas.c
==
--- stable/9/sys/dev/mpr/mpr_sas.c  Thu May 22 16:34:00 2014
(r266548)
+++ stable/9/sys/dev/mpr/mpr_sas.c  Thu May 22 16:36:01 2014
(r266549)
@@ -183,7 +183,8 @@ mprsas_startup_increment(struct mprsas_s
/* just starting, freeze the simq */
mpr_dprint(sassc->sc, MPR_INIT,
"%s freezing simq\n", __func__);
-#if __FreeBSD_version >= 139
+#if (__FreeBSD_version >= 139) || \
+((__FreeBSD_version < 100) && (__FreeBSD_version >= 902502))
xpt_hold_boot();
 #endif
xpt_freeze_simq(sassc->sim, 1);
@@ -217,7 +218,8 @@ mprsas_startup_decrement(struct mprsas_s
"%s releasing simq\n", __func__);
sassc->flags &= ~MPRSAS_IN_STARTUP;
xpt_release_simq(sassc->sim, 1);
-#if __FreeBSD_version >= 139
+#if (__FreeBSD_version >= 139) || \
+((__FreeBSD_version < 100) && (__FreeBSD_version >= 902502))
xpt_release_boot();
 #else
mprsas_rescan_target(sassc->sc, NULL);
@@ -974,7 +976,8 @@ mprsas_action(struct cam_sim *sim, union
cpi->version_num = 1;
cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16;
cpi->target_sprt = 0;
-#if __FreeBSD_version >= 139
+#if (__FreeBSD_version >= 139) || \
+((__FreeBSD_version < 100) && (__FreeBSD_version >= 902502))
cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED | PIM_NOSCAN;
 #else
cpi->hba_mi

svn commit: r266754 - svnadmin/conf

2014-05-27 Thread Kenneth D. Merry
Author: ken
Date: Tue May 27 16:13:01 2014
New Revision: 266754
URL: http://svnweb.freebsd.org/changeset/base/266754

Log:
  Add Kashyap Desai (kadesai) as a src committer.
  
  Kashyap works for LSI (which is now Avago) and will be maintaing drivers
  for LSI's SAS and RAID products (mps(4), mpr(4), mrsas(4)).
  
  scottl, ambrisko and ken will be his mentors.
  
  Approved by:  core

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

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessTue May 27 15:55:26 2014(r266753)
+++ svnadmin/conf/accessTue May 27 16:13:01 2014(r266754)
@@ -126,6 +126,7 @@ jonathan
 jpaetzel
 julian
 jwd
+kadesai
 kaiw
 kan
 kargl

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Tue May 27 15:55:26 2014(r266753)
+++ svnadmin/conf/mentors   Tue May 27 16:13:01 2014(r266754)
@@ -23,6 +23,7 @@ jceel wkoszek Co-mentor: cognet
 jkhrwatson
 jonathan   rwatson
 jwdrmacklem
+kadesaiken Co-mentor: scottl, ambrisko
 miwi   rwatson
 monthadar  adrian
 odeds  jhb Co-mentor: alfred
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r254627 - in head: bin/chflags bin/ls lib/libc/gen lib/libc/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/msdosfs sys/fs/smbfs sys/sys sys/ufs/ufs

2014-06-27 Thread Kenneth D. Merry
On Fri, Jun 27, 2014 at 12:48:29 -0700, Xin LI wrote:
> Hi,
> 
> Craig have hit an interesting issue today, where he tried to 'mv' a file
> from ZFS dataset to a NFS mount, 'mv' bails out because chflags failed.
> 
> I think it's probably sensible to have mv ignoring UF_ARCHIVE, and set the
> flag on the target unconditionally?  i.e.:
> 
> Index: mv.c
> ===
> --- mv.c (revision 267940)
> +++ mv.c (working copy)
> @@ -337,8 +337,8 @@
>   * on a file that we copied, i.e., that we didn't create.)
>   */
>   errno = 0;
> - if (fchflags(to_fd, sbp->st_flags))
> - if (errno != EOPNOTSUPP || sbp->st_flags != 0)
> + if (fchflags(to_fd, sbp->st_flags | UF_ARCHIVE))
> + if (errno != EOPNOTSUPP || (sbp->st_flags & ~UF_ARCHIVE) != 0)
>   warn("%s: set flags (was: 0%07o)", to, sbp->st_flags);
> 
>   tval[0].tv_sec = sbp->st_atime;

Yes, that sounds like a good way to do it.

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


Re: svn commit: r267986 - head/sys/cam/ctl

2014-06-27 Thread Kenneth D. Merry
On Fri, Jun 27, 2014 at 22:28:14 +, Alexander Motin wrote:
> Author: mav
> Date: Fri Jun 27 22:28:14 2014
> New Revision: 267986
> URL: http://svnweb.freebsd.org/changeset/base/267986
> 
> Log:
>   Remove odd practice of inverting error codes.
>   
>   -EPERM is equal to ERESTART, returning which from ioctl() handler causes
>   infinite syscall restart.
>   
>   MFC after:  2 weeks

Oops.  Not sure how I left that in there.

I suppose you can tell it was originally written for Linux. :)

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


svn commit: r268240 - in head: sbin/camcontrol sys/cam/scsi

2014-07-03 Thread Kenneth D. Merry
Author: ken
Date: Thu Jul  3 23:09:44 2014
New Revision: 268240
URL: http://svnweb.freebsd.org/changeset/base/268240

Log:
  Add persistent reservation support to camcontrol(8).
  
  camcontrol(8) now supports a new 'persist' subcommand that allows users to
  issue SCSI PERSISTENT RESERVE IN / OUT commands.
  
  sbin/camcontrol/Makefile:
Add persist.c.
  
  sbin/camcontrol/persist.c:
New persistent reservation support for camcontrol(8).
  
We have support for all known operation modes for PERSISTENT RESERVE
IN and PERSISTENT RESERVE OUT.
exceptions noted above.
  
  sbin/camcontrol/camcontrol.8:
Document the new 'persist' subcommand.
  
In the section on the Transport ID (-I) option, explain what
Transport IDs for each protocol should look like.  At some point
some of this information could probably get moved off in a
separate man page, either on Transport IDs alone or a man page
documenting the Transport ID parsing code.
  
Add a number of examples of persistent reservation commands.
Persistent Reservations are complex enough that the average user
probably won't be able to get the commands exactly right by just
reading the man page.  These examples show a few basic and
advanced examples of how to use persistent reservations.
  
  sbin/camcontrol/camcontrol.h:
Move the definition for camcontrol_optret here, so we can use it
for the persistent reservation code.
  
Add a definition for the new scsipersist() function.
  
  sbin/camcontrol/camcontrol.c:
Add 'persist' to the list of subcommands.
  
Document 'persist' in the help text.
  
  sys/cam/scsi/scsi_all.c:
Add the scsi_persistent_reserve_in() and
scsi_persistent_reserve_out() CCB building functions.
  
Add a new function, scsi_transportid_sbuf().  This takes a
SCSI Transport ID (documented in SPC-4), and prints it to
an sbuf(9).  There are some transports (like ATA, USB, and
SSA) for which there is no transport defined.  We need to
come up with a reasonable thing to do if we're presented
with a Transport ID that claims to be for one of those
protocols.
  
Add new routines scsi_get_nv() and scsi_nv_to_str().
  
These functions do a table lookup to go between a string and an
integer.  There are lots of table lookups needed in the
persistent reservation code in camcontrol(8).
  
Add a new function, scsi_parse_transportid(), along with leaf node
functions to parse:
FC, 1394 and SAS (scsi_parse_transportid_64bit())
iSCSI (scsi_parse_transportid_iscsi())
SPI (scsi_parse_transportid_spi())
RDMA (scsi_parse_transportid_rdma())
PCIe (scsi_parse_transportid_sop())
  
Transport IDs.  Given a string with the general form proto,id these
functions create a SCSI Transport ID structure.
  
  sys/cam/scsi/scsi_all.h:
Update the various persistent reservation data structures to
SPC4r36l, but also rename some fields that were previously
obsolete with the proper names from older SCSI specs.  This
allows using older, obsolete persistent reservation types when
desired.
  
Add function prototypes for the new persistent reservation CCB
building functions.
  
Add a data strucure for the READ FULL STATUS service action
of the PERSISTENT RESERVE IN command.
  
Add Transport ID structures for all protocols described in SPC-4.
  
Add a new series of SCSI_PROTO_XXX definitions, and
redefine other defines in terms of these new definitions.
  
Add a prototype for scsi_transportid_sbuf().
  
Change a couple of "obsolete" persistent reservation data
structure fields into something more meaningful, based on
what the field was called when it was defined in the spec.
(e.g. SPC, SPC-2, etc.)
  
Create a new define, SPRI_MAX_LEN, for the maximum allocation
length allowed for the PERSISTENT RESERVE IN command.
  
Add data structures and enumerations for the new name/value
translation functions.
  
Add data structures for SCSI over PCIe Routing IDs.
  
Bring the PERSISTENT RESERVE OUT Register and Move parameter list
structure (struct scsi_per_res_out_parms) up to date with SPC-4.
  
Add a data structure for the transport IDs that can optionally be
appended to the basic PERSISTENT RESERVE OUT parameter list.
  
Move SCSI protocol macro definitions out of the VPD page 0x83
definition and combine them with the more up to date protocol
definitions higher in the file.
  
Add function prototypes for scsi_nv_to_str(), scsi_get_nv(),
scsi_parse_transportid_64bit(), scsi_parse_transportid_spi(),
scsi_parse_transp

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

2015-01-08 Thread Kenneth D. Merry
Author: ken
Date: Thu Jan  8 16:27:56 2015
New Revision: 276831
URL: https://svnweb.freebsd.org/changeset/base/276831

Log:
  Fix a bug in the CAM SCSI probe code that caused changes in inquiry
  data to go undetected.
  
  The probe code does an MD5 checksum of the inquiry data (and page
  0x80 serial number if available) before doing a reprobe of an
  existing device, and then compares a checksum after the probe to
  see whether the device has changed.
  
  This check was broken in January, 2000 by change 56146 when the extended
  inquiry probe code was added.
  
  In the extended inquiry probe case, it was calculating the checksum
  a second time.  The second time it included the updated inquiry
  data from the short inquiry probe (first 36 bytes).  So it wouldn't
  catch cases where the vendor, product, revision, etc. changed.
  
  This change will have the effect that when a device's inquiry data is
  updated and a rescan is issued, it will disappear and then reappear.
  This is the appropriate action, because if the inquiry data or serial
  number changes, it is either a different device or the device
  configuration may have changed significantly.  (e.g. with updated
  firmware.)
  
  scsi_xpt.c:   Don't calculate the initial MD5 checksum on
standard inquiry data and the page 0x80 serial
number if we have already calculated it.
  
  MFC after:1 week
  Sponsored by: Spectra Logic

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

Modified: head/sys/cam/scsi/scsi_xpt.c
==
--- head/sys/cam/scsi/scsi_xpt.cThu Jan  8 16:13:21 2015
(r276830)
+++ head/sys/cam/scsi/scsi_xpt.cThu Jan  8 16:27:56 2015
(r276831)
@@ -755,7 +755,8 @@ again:
 * serial number check finish, we attempt to figure out
 * whether we still have the same device.
 */
-   if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) {
+   if (((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0)
+&& ((softc->flags & PROBE_INQUIRY_CKSUM) == 0)) {
 
MD5Init(&softc->context);
MD5Update(&softc->context, (unsigned char *)inq_buf,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r276835 - in head: sbin/camcontrol sys/cam/scsi

2015-01-08 Thread Kenneth D. Merry
Author: ken
Date: Thu Jan  8 16:58:40 2015
New Revision: 276835
URL: https://svnweb.freebsd.org/changeset/base/276835

Log:
  Improve camcontrol(8) handling of drive defect data.
  
  This includes a new summary mode (-s) for camcontrol defects that
  quickly tells the user the most important thing: how many defects
  are in the requested list.  The actual location of the defects is
  less important.
  
  Modern drives frequently have more than the 8191 defects that can
  be reported by the READ DEFECT DATA (10) command.  If they don't
  have that many grown defects, they certainly have more than 8191
  defects in the primary (i.e. factory) defect list.
  
  The READ DEFECT DATA (12) command allows for longer parameter
  lists, as well as indexing into the list of defects, and so allows
  reporting many more defects.
  
  This has been tested with HGST drives and Seagate drives, but
  does not fully work with Seagate drives.  Once I have a Seagate
  spec I may be able to determine whether it is possible to make it
  work with Seagate drives.
  
  scsi_da.h:Add a definition for the new long block defect
format.
  
Add bit and mask definitions for the new extended
physical sector and bytes from index defect
formats.
  
Add a prototype for the new scsi_read_defects() CDB
building function.
  
  scsi_da.c:Add a new scsi_read_defects() CDB building function.
camcontrol(8) was previously composing CDBs manually.
This is long overdue.
  
  camcontrol.c: Revamp the camcontrol defects subcommand.  We now
go through multiple stages in trying to get defect
data off the drive while avoiding various drive
firmware quirks.
  
We start off by requesting the defect header with
the 10 byte command.  If we're in summary mode (-s)
and the drive reports fewer defects than can be
represented in the 10 byte header, we're done.
Otherwise, we know that we need to issue the
12 byte command if the drive reports the maximum
number of defects.
  
If we're in summary mode, we're done if we get a
good response back when asking for the 12 byte header.
  
If the user has asked for the full list, then we
use the address descriptor index field in the 12
byte CDB to step through the list in 64K chunks.
64K is small enough to work with most any ancient
or modern SCSI controller.
  
Add support for printing the new long block defect
format, as well as the extended physical sector and
bytes from index formats.  I don't have any drives
that support the new formats.
  
Add a hexadecimal output format that can be turned
on with -X.
  
Add a quiet mode (-q) that can be turned on with
the summary mode (-s) to just print out a number.
  
Revamp the error detection and recovery code for
the defects command to work with HGST drives.
  
Call the new scsi_read_defects() CDB building
function instead of rolling the CDB ourselves.
  
Pay attention to the residual from the defect list
request when printing it out, so we don't run off
the end of the list.
  
Use the new scsi_nv library routines to convert
from strings to numbers and back.
  
  camcontrol.8: Document the new defect formats (longblock, extbfi,
extphys) and command line options (-q, -s, -S and
-X) for the defects subcommand.
  
Explain a little more about what drives generally
do and don't support.
  
  Sponsored by: Spectra Logic
  MFC after:1 week

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_da.h

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Thu Jan  8 16:50:35 2015
(r276834)
+++ head/sbin/camcontrol/camcontrol.8   Thu Jan  8 16:58:40 2015
(r276835)
@@ -110,6 +110,10 @@
 .Aq Fl f Ar format
 .Op Fl P
 .Op Fl G
+.Op Fl q
+.Op Fl s
+.Op Fl S Ar offset
+.Op Fl X
 .Nm
 .Ic modepage
 .Op device id
@@ -513,18 +517,16 @@ connecting to that device.
 Note that this can have a destructive impact
 on the system.
 .It Ic defects
-Send the SCSI READ DEFECT DATA (10) command (0x37) to the given device, and
+Send the
+.Tn SCSI
+READ DEFECT DATA (10) command (0x37) or the 
+.Tn SCSI
+READ DEFECT DATA (12) command (0xB7) to the given device, and
 print 

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

2015-01-08 Thread Kenneth D. Merry
Author: ken
Date: Thu Jan  8 17:41:28 2015
New Revision: 276839
URL: https://svnweb.freebsd.org/changeset/base/276839

Log:
  Fix Fibre Channel Command Reference Number handling in the isp(4) driver.
  
  The Command Reference Number is used for precise delivery of
  commands, and is part of the FC-Tape functionality set.  (This is
  only enabled for devices that support precise delivery of commands.)
  It is an 8-bit unsigned number that increments from 1 to 255.  The
  commands sent by the initiator must be processed by the target in
  CRN order if the CRN is non-zero.
  
  There are certain scenarios where the Command Reference Number
  sequence needs to be reset.  When the target is power cycled, for
  instance, the initiator needs to reset the CRN to 1.  The initiator
  will know this because it will see a LIP (when directly connected)
  or get a logout/login event (when connected to a switch).
  
  The isp(4) driver was not resetting the CRN when a target
  went away and came back.  When it saw the target again after a
  power cycle, it would continue the CRN sequence where it left off.
  The target would ignore the command because the CRN sequence is
  supposed to be reset to 1 after a power cycle or other similar
  event.
  
  The symptom that the user would see is that there would be lots of
  aborted INQUIRY commands after a tape library was power cycled, and
  the library would fail to probe.  The INQUIRY commands were being
  ignored by the tape drive due to the CRN issue mentioned above.
  
  isp_freebsd.c:
Add a new function, isp_fcp_reset_crn().  This will reset
all of the CRNs for a given port, or the CRNs for all LUNs
on a target.
  
Reset the CRNs for all targets on a port when we get a LIP,
loop reset, or loop down event.
  
Reset the CRN for a particular target when it arrives, is changed
or departs.  This is less precise behavior than the
clearing behavior specified in the FCP-4 spec (which says
that it should be reset for PRLI, PRLO, PLOGI and LOGO),
but this is the level of information we have here.  If this
is insufficient, then we will need to add more precise
notification from the lower level isp(4) code.
  
  isp_freebsd.h:
Add a prototype for isp_fcp_reset_crn().
  
  Sponsored by: Spectra Logic
  MFC after:1 week

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

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Thu Jan  8 17:38:03 2015
(r276838)
+++ head/sys/dev/isp/isp_freebsd.c  Thu Jan  8 17:41:28 2015
(r276839)
@@ -5696,6 +5696,8 @@ isp_async(ispsoftc_t *isp, ispasync_t cm
}
}
}
+   isp_fcp_reset_crn(fc, /*tgt*/0, /*tgt_set*/ 0);
+
isp_prt(isp, ISP_LOGINFO, "Chan %d: %s", bus, msg);
break;
}
@@ -5747,6 +5749,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm
if (lp->dev_map_idx) {
tgt = lp->dev_map_idx - 1;
isp_prt(isp, ISP_LOGCONFIG, prom2, bus, lp->portid, 
lp->handle, buf, "arrived at", tgt, (uint32_t) (lp->port_wwn >> 32), (uint32_t) 
lp->port_wwn);
+   isp_fcp_reset_crn(fc, tgt, /*tgt_set*/ 1);
isp_make_here(isp, bus, tgt);
} else {
isp_prt(isp, ISP_LOGCONFIG, prom0, bus, lp->portid, 
lp->handle, buf, "arrived", (uint32_t) (lp->port_wwn >> 32), (uint32_t) 
lp->port_wwn);
@@ -5783,6 +5786,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm
tgt = lp->dev_map_idx - 1;
isp_prt(isp, ISP_LOGCONFIG, prom2, bus, 
lp->portid, lp->handle, buf, "changed at", tgt,
(uint32_t) (lp->port_wwn >> 32), (uint32_t) 
lp->port_wwn);
+   isp_fcp_reset_crn(fc, tgt, /*tgt_set*/ 1);
} else {
isp_prt(isp, ISP_LOGCONFIG, prom0, bus, 
lp->portid, lp->handle, buf, "changed", (uint32_t) (lp->port_wwn >> 32), 
(uint32_t) lp->port_wwn);
}
@@ -5795,6 +5799,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm
va_end(ap);
isp_gen_role_str(buf, sizeof (buf), lp->prli_word3);
if (lp->dev_map_idx) {
+   fc = ISP_FC_PC(isp, bus);
tgt = lp->dev_map_idx - 1;
isp_prt(isp, ISP_LOGCONFIG, prom2, bus, lp->portid, 
lp->handle, buf, "stayed at", tgt,
(uint32_t) (lp->port_wwn >> 32), (uint32_t) 
lp->port_wwn);
@@ -5829,6 +5834,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm
}
tgt = lp->dev_map_idx - 1;
  

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

2015-01-08 Thread Kenneth D. Merry
Author: ken
Date: Thu Jan  8 17:51:12 2015
New Revision: 276842
URL: https://svnweb.freebsd.org/changeset/base/276842

Log:
  Close a race in the isp(4) driver that caused devices to disappear
  and not automatically come back if they were gone for a short
  period of time.
  
  The isp(4) driver has a 30 second gone device timer that gets
  activated whenever a device goes away.  If the device comes back
  before the timer expires, we don't send a notification to CAM that
  it has gone away.  If, however, there is a command sent to the
  device while it is gone and before it comes back, the isp(4) driver
  sends the command back with CAM_SEL_TIMEOUT status.
  
  CAM responds to the CAM_SEL_TIMEOUT status by removing the device.
  In the case where a device comes back within the 30 second gone
  device timer window, though, we weren't telling CAM the device
  came back.
  
  So, fix this by tracking whether we have told CAM the device is
  gone, and if we have, send a rescan if it comes back within the 30
  second window.
  
  ispvar.h:
In the fcportdb_t structure, add a new bitfield,
reported_gone.  This gets set whenever we return a command
with CAM_SEL_TIMEOUT status on a Fibre Channel device.
  
  isp_freebsd.c:
In isp_done(), if we're sending CAM_SEL_TIMEOUT for for a
command sent to a FC device, set the reported_gone bit.
  
In isp_async(), in the ISPASYNC_DEV_STAYED case, rescan the
device in question if it is mapped to a target ID and has
been reported gone.
  
In isp_make_here(), take a port database entry argument,
and clear the reported_gone bit when we send a rescan to
CAM.
  
In isp_make_gone(), take a port database entry as an
argument, and set the reported_gone bit when we send an
async event telling CAM consumers that the device is gone.
  
  Sponsored by: Spectra Logic
  MFC after:1 week

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

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Thu Jan  8 17:49:07 2015
(r276841)
+++ head/sys/dev/isp/isp_freebsd.c  Thu Jan  8 17:51:12 2015
(r276842)
@@ -4565,7 +4565,7 @@ isp_watchdog(void *arg)
 }
 
 static void
-isp_make_here(ispsoftc_t *isp, int chan, int tgt)
+isp_make_here(ispsoftc_t *isp, fcportdb_t *fcp, int chan, int tgt)
 {
union ccb *ccb;
struct isp_fc *fc = ISP_FC_PC(isp, chan);
@@ -4588,11 +4588,18 @@ isp_make_here(ispsoftc_t *isp, int chan,
xpt_free_ccb(ccb);
return;
}
+
+   /*
+* Since we're about to issue a rescan, mark this device as not
+* reported gone.
+*/
+   fcp->reported_gone = 0;
+
xpt_rescan(ccb);
 }
 
 static void
-isp_make_gone(ispsoftc_t *isp, int chan, int tgt)
+isp_make_gone(ispsoftc_t *isp, fcportdb_t *fcp, int chan, int tgt)
 {
struct cam_path *tp;
struct isp_fc *fc = ISP_FC_PC(isp, chan);
@@ -4601,6 +4608,11 @@ isp_make_gone(ispsoftc_t *isp, int chan,
return;
}
if (xpt_create_path(&tp, NULL, cam_sim_path(fc->sim), tgt, 
CAM_LUN_WILDCARD) == CAM_REQ_CMP) {
+   /*
+* We're about to send out the lost device async
+* notification, so indicate that we have reported it gone.
+*/
+   fcp->reported_gone = 1;
xpt_async(AC_LOST_DEVICE, tp, NULL);
xpt_free_path(tp);
}
@@ -4654,7 +4666,7 @@ isp_gdt_task(void *arg, int pending)
lp->dev_map_idx = 0;
lp->state = FC_PORTDB_STATE_NIL;
isp_prt(isp, ISP_LOGCONFIG, prom3, chan, lp->portid, tgt, "Gone 
Device Timeout");
-   isp_make_gone(isp, chan, tgt);
+   isp_make_gone(isp, lp, chan, tgt);
}
if (fc->ready) {
if (more_to_do) {
@@ -4747,7 +4759,7 @@ isp_ldt_task(void *arg, int pending)
lp->dev_map_idx = 0;
lp->state = FC_PORTDB_STATE_NIL;
isp_prt(isp, ISP_LOGCONFIG, prom3, chan, lp->portid, tgt, "Loop 
Down Timeout");
-   isp_make_gone(isp, chan, tgt);
+   isp_make_gone(isp, lp, chan, tgt);
}
 
if (FCPARAM(isp, chan)->role & ISP_ROLE_INITIATOR) {
@@ -5561,6 +5573,21 @@ isp_done(XS_T *sccb)
if (status != CAM_REQ_CMP) {
if (status != CAM_SEL_TIMEOUT)
isp_prt(isp, ISP_LOGDEBUG0, "target %d lun %d CAM 
status 0x%x SCSI status 0x%x", XS_TGT(sccb), XS_LUN(sccb), sccb->ccb_h.status, 
sccb->scsi_status);
+   else if ((IS_FC(isp))
+ && (XS_TGT(sccb) < MAX_FC_TARG)) {
+   fcparam *fcp;
+   int hdlidx;
+
+   fcp = FCPARAM(isp, XS_CHANNEL(sccb));
+

svn commit: r280230 - in head: sys/cam/scsi usr.bin/mt

2015-03-18 Thread Kenneth D. Merry
Author: ken
Date: Wed Mar 18 20:52:34 2015
New Revision: 280230
URL: https://svnweb.freebsd.org/changeset/base/280230

Log:
  Fix a couple of problems in the sa(4) media type reports.
  
  The only drives I have discovered so far that support medium type
  reports are newer HP LTO (LTO-5 and LTO-6) drives.  IBM drives
  only support the density reports.
  
  sys/cam/scsi/scsi_sa.h:
The number of possible density codes in the medium type
report is 9, not 8.  This caused problems parsing all of
the medium type report after this point in the structure.
  
  usr.bin/mt/mt.c:
Run the density codes returned in the medium type report
through denstostring(), just like the primary and secondary
density codes in the density report.  This will print the
density code in hex, and give a text description if it
is available.
  
  Thanks to Rudolf Cejka for doing extensive testing with HP LTO drives
  and Bacula and discovering these problems.
  
  Tested by:Rudolf Cejka 
  Sponsored by: Spectra Logic
  MFC after:4 days

Modified:
  head/sys/cam/scsi/scsi_sa.h
  head/usr.bin/mt/mt.c

Modified: head/sys/cam/scsi/scsi_sa.h
==
--- head/sys/cam/scsi/scsi_sa.h Wed Mar 18 20:40:42 2015(r280229)
+++ head/sys/cam/scsi/scsi_sa.h Wed Mar 18 20:52:34 2015(r280230)
@@ -477,7 +477,7 @@ struct scsi_medium_type_data {
u_int8_t length[2];
 #defineSMTD_DEFAULT_LENGTH 52
u_int8_t num_density_codes;
-   u_int8_t primary_density_codes[8];
+   u_int8_t primary_density_codes[9];
u_int8_t media_width[2];
u_int8_t medium_length[2];
u_int8_t reserved2[2];

Modified: head/usr.bin/mt/mt.c
==
--- head/usr.bin/mt/mt.cWed Mar 18 20:40:42 2015(r280229)
+++ head/usr.bin/mt/mt.cWed Mar 18 20:52:34 2015(r280230)
@@ -1406,9 +1406,9 @@ mt_print_density_entry(struct mt_status_
continue;
}
if ((strcmp(entry->entry_name, "primary_density_code") == 0)
-|| (strcmp(entry->entry_name, "secondary_density_code") == 0)){
+|| (strcmp(entry->entry_name, "secondary_density_code") == 0)
+|| (strcmp(entry->entry_name, "density_code") == 0)) {
 
-   /* XXX KDM this should really be unsigned */
printf("%*s%s (%s): %s\n", indent, "", entry->desc ?
entry->desc : "", entry->entry_name,
denstostring(entry->value_unsigned));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-03-18 Thread Kenneth D. Merry
Author: ken
Date: Wed Mar 18 20:54:54 2015
New Revision: 280231
URL: https://svnweb.freebsd.org/changeset/base/280231

Log:
  Improve the mt(1) rblim display.
  
  The granularity reported by READ BLOCK LIMITS is an exponent, not a
  byte value.  So a granularity of 0 means 2^0, or 1 byte.  A
  granularity of 1 means 2^1, or 2 bytes.
  
  Print out the individual block limits on separate lines to improve
  readability and avoid exceeding 80 columns.
  
  usr.bin/mt/mt.c:
Fix and improve the 'mt rblim' output.  Add a MT_PLURAL()
macro so we can print "byte" or "bytes" as appropriate.
  
  Sponsored by: Spectra Logic
  MFC after:4 days

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

Modified: head/usr.bin/mt/mt.c
==
--- head/usr.bin/mt/mt.cWed Mar 18 20:52:34 2015(r280230)
+++ head/usr.bin/mt/mt.cWed Mar 18 20:54:54 2015(r280231)
@@ -119,6 +119,7 @@ __FBSDID("$FreeBSD$");
 #ifndef MAX
 #defineMAX(a, b) (a > b) ? a : b
 #endif
+#define MT_PLURAL(a) (a == 1) ? "" : "s"
 
 typedef enum {
MT_CMD_NONE = MTLOAD + 1,
@@ -384,10 +385,16 @@ main(int argc, char *argv[])
 
if (ioctl(mtfd, MTIOCRBLIM, (caddr_t)&rblim) < 0)
err(2, "%s", tape);
-   (void)printf("%s: min blocksize %u bytes, "
-   "max blocksize %u bytes, granularity %u bytes\n",
+   (void)printf("%s:\n"
+   "min blocksize %u byte%s\n"
+   "max blocksize %u byte%s\n"
+   "granularity %u byte%s\n",
tape, rblim.min_block_length,
-   rblim.max_block_length, rblim.granularity);
+   MT_PLURAL(rblim.min_block_length),
+   rblim.max_block_length,
+   MT_PLURAL(rblim.max_block_length),
+   (1 << rblim.granularity),
+   MT_PLURAL((1 << rblim.granularity)));
exit(0);
/* NOTREACHED */
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r280438 - in stable/10: contrib/groff/tmac lib lib/libmt rescue/rescue share/man/man4 share/mk sys/cam/scsi sys/sys usr.bin/mt

2015-03-24 Thread Kenneth D. Merry
Author: ken
Date: Tue Mar 24 14:36:10 2015
New Revision: 280438
URL: https://svnweb.freebsd.org/changeset/base/280438

Log:
  MFC sa(4) and mt(1) improvements.
  
  This includes these changes: 279219, 279229, 279261, 279534, 279570,
  280230, 280231.
  
  In addition, bump __FreeBSD_version for the addition of the new
  mtio(4) / sa(4) ioctls.
  
  Thanks to Dan Langille, Harald Schmalzbauer and Rudolf Cejka for spending
  a significant amount of time and effort testing these changes.
  

r279219 | ken | 2015-02-23 14:59:30 -0700 (Mon, 23 Feb 2015) | 282 lines
  
Significant upgrades to sa(4) and mt(1).
  
The primary focus of these changes is to modernize FreeBSD's
tape infrastructure so that we can take advantage of some of the
features of modern tape drives and allow support for LTFS.
  
Significant changes and new features include:
  
 o sa(4) driver status and parameter information is now exported via an
   XML structure.  This will allow for changes and improvements later
   on that will not break userland applications.  The old MTIOCGET
   status ioctl remains, so applications using the existing interface
   will not break.
  
 o 'mt status' now reports drive-reported tape position information
   as well as the previously available calculated tape position
   information.  These numbers will be different at times, because
   the drive-reported block numbers are relative to BOP (Beginning
   of Partition), but the block numbers calculated previously via
   sa(4) (and still provided) are relative to the last filemark.
   Both numbers are now provided.  'mt status' now also shows the
   drive INQUIRY information, serial number and any position flags
   (BOP, EOT, etc.) provided with the tape position information.
   'mt status -v' adds information on the maximum possible I/O size,
   and the underlying values used to calculate it.
  
 o The extra sa(4) /dev entries (/dev/saN.[0-3]) have been removed.
  
   The extra devices were originally added as place holders for
   density-specific device nodes.  Some OSes (NetBSD, NetApp's OnTap
   and Solaris) have had device nodes that, when you write to them,
   will automatically select a given density for particular tape drives.
  
   This is a convenient way of switching densities, but it was never
   implemented in FreeBSD.  Only the device nodes were there, and that
   sometimes confused users.
  
   For modern tape devices, the density is generally not selectable
   (e.g. with LTO) or defaults to the highest availble density when
   the tape is rewritten from BOT (e.g. TS11X0).  So, for most users,
   density selection won't be necessary.  If they do need to select
   the density, it is easy enough to use 'mt density' to change it.
  
 o Protection information is now supported.  This is either a
   Reed-Solomon CRC or CRC32 that is included at the end of each block
   read and written.  On write, the tape drive verifies the CRC, and
   on read, the tape drive provides a CRC for the userland application
   to verify.
  
 o New, extensible tape driver parameter get/set interface.
  
 o Density reporting information.  For drives that support it,
   'mt getdensity' will show detailed information on what formats the
   tape drive supports, and what formats the tape drive supports.
  
 o Some mt(1) functionality moved into a new mt(3) library so that
   external applications can reuse the code.
  
 o The new mt(3) library includes helper routines to aid in parsing
   the XML output of the sa(4) driver, and build a tree of driver
   metadata.
  
 o Support for the MTLOAD (load a tape in the drive) and MTWEOFI
   (write filemark immediate) ioctls needed by IBM's LTFS
   implementation.
  
 o Improve device departure behavior for the sa(4) driver.  The previous
   implementation led to hangs when the device was open.
  
 o This has been tested on the following types of drives:
IBM TS1150
IBM TS1140
IBM LTO-6
IBM LTO-5
HP LTO-2
Seagate DDS-4
Quantum DLT-4000
Exabyte 8505
Sony DDS-2
  
contrib/groff/tmac/doc-syms,
share/mk/bsd.libnames.mk,
lib/Makefile,
Add libmt.
  
lib/libmt/Makefile,
lib/libmt/mt.3,
lib/libmt/mtlib.c,
lib/libmt/mtlib.h,
New mt(3) library that contains functions moved from mt(1) and
new functions needed to interact with the updated sa(4) driver.
  
This includes XML parser helper functions that application writers
can use when writing code to query tape parameters.
  
rescue/rescue/Makefile:
Add -lmt to CRUNCH_LIBS.
  
src/share/man/man4/mtio.4
Clarify this man page a bit, and since it contains 

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

2015-03-24 Thread Kenneth D. Merry
Author: ken
Date: Tue Mar 24 16:53:16 2015
New Revision: 280446
URL: https://svnweb.freebsd.org/changeset/base/280446

Log:
  MFC, r279375
  

r279375 | ken | 2015-02-27 14:35:36 -0700 (Fri, 27 Feb 2015) | 26 lines
  
Fix I/O size calculation for pass(4) driver requests and add latency
tracking.
  
It is important to subtract the residual from the requested
transfer size to see how much data was actually transferred.  With
tape drives in particular, it is common to request more data than is
returned.
  
Also, add I/O latency tracking for CAM requests issued by
cam_periph_runccb().
  
If the caller supplies a struct devstat, and the I/O is a SCSI or
ATA I/O, we will track the elapsed time to provide I/O latency
statistics for the request.
  
sys/cam/scsi/cam_periph.c:
In cam_periph_runccb(), subtract the residual when reporting I/O
totals to devstat(9) for SCSI and ATA passthrough requests.
  
In cam_periph_runccb(), grab the I/O start time and supply
the start time to devstat_end_transaction() so that it can
calculate the elapsed I/O time.
  
Sponsored by:   Spectra Logic
MFC after:  1 week
  

  
  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  Tue Mar 24 16:46:40 2015
(r280445)
+++ stable/10/sys/cam/cam_periph.c  Tue Mar 24 16:53:16 2015
(r280446)
@@ -1048,8 +1048,11 @@ cam_periph_runccb(union ccb *ccb,
  cam_flags camflags, u_int32_t sense_flags,
  struct devstat *ds)
 {
+   struct bintime *starttime;
+   struct bintime ltime;
int error;
  
+   starttime = NULL;
xpt_path_assert(ccb->ccb_h.path, MA_OWNED);
 
/*
@@ -1057,8 +1060,11 @@ cam_periph_runccb(union ccb *ccb,
 * this particular type of ccb, record the transaction start.
 */
if ((ds != NULL) && (ccb->ccb_h.func_code == XPT_SCSI_IO ||
-   ccb->ccb_h.func_code == XPT_ATA_IO))
-   devstat_start_transaction(ds, NULL);
+   ccb->ccb_h.func_code == XPT_ATA_IO)) {
+   starttime = ccb_h.cbfcnp = cam_periph_done;
xpt_action(ccb);
@@ -1086,22 +1092,22 @@ cam_periph_runccb(union ccb *ccb,
if (ds != NULL) {
if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
devstat_end_transaction(ds,
-   ccb->csio.dxfer_len,
+   ccb->csio.dxfer_len - ccb->csio.resid,
ccb->csio.tag_action & 0x3,
((ccb->ccb_h.flags & CAM_DIR_MASK) ==
CAM_DIR_NONE) ?  DEVSTAT_NO_DATA : 
(ccb->ccb_h.flags & CAM_DIR_OUT) ?
DEVSTAT_WRITE : 
-   DEVSTAT_READ, NULL, NULL);
+   DEVSTAT_READ, NULL, starttime);
} else if (ccb->ccb_h.func_code == XPT_ATA_IO) {
devstat_end_transaction(ds,
-   ccb->ataio.dxfer_len,
+   ccb->ataio.dxfer_len - ccb->ataio.resid,
ccb->ataio.tag_action & 0x3,
((ccb->ccb_h.flags & CAM_DIR_MASK) ==
CAM_DIR_NONE) ?  DEVSTAT_NO_DATA : 
(ccb->ccb_h.flags & CAM_DIR_OUT) ?
DEVSTAT_WRITE : 
-   DEVSTAT_READ, NULL, NULL);
+   DEVSTAT_READ, NULL, starttime);
}
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-03-24 Thread Kenneth D. Merry
Author: ken
Date: Tue Mar 24 17:20:20 2015
New Revision: 280448
URL: https://svnweb.freebsd.org/changeset/base/280448

Log:
  MFC, r279336:
  

r279336 | ken | 2015-02-26 15:22:06 -0700 (Thu, 26 Feb 2015) | 12 lines
  
Add FreeBSD stable/10 version checks for the availability of the
CDAI_FLAG_NONE advanced information CCB flag.
  
Support for the flag was merged to stable/10 in r279329, and the
__FreeBSD_version in stable/10 was bumped to 1001510.
  
Check for that version in the mps(4) and mpr(4) drivers when determining
whether to use the flag.
  
Sponsored by:   Spectra Logic
MFC after:  3 days
  


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

Modified: stable/10/sys/dev/mpr/mpr_sas.c
==
--- stable/10/sys/dev/mpr/mpr_sas.c Tue Mar 24 17:12:36 2015
(r280447)
+++ stable/10/sys/dev/mpr/mpr_sas.c Tue Mar 24 17:20:20 2015
(r280448)
@@ -3084,7 +3084,8 @@ mprsas_async(void *callback_arg, uint32_
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.ccb_h.flags = CAM_DIR_IN;
cdai.buftype = CDAI_TYPE_RCAPLONG;
-#if __FreeBSD_version >= 1100061
+#if (__FreeBSD_version >= 1100061) || \
+((__FreeBSD_version >= 1001510) && (__FreeBSD_version < 110))
cdai.flags = CDAI_FLAG_NONE;
 #else
cdai.flags = 0;

Modified: stable/10/sys/dev/mps/mps_sas.c
==
--- stable/10/sys/dev/mps/mps_sas.c Tue Mar 24 17:12:36 2015
(r280447)
+++ stable/10/sys/dev/mps/mps_sas.c Tue Mar 24 17:20:20 2015
(r280448)
@@ -3237,7 +3237,8 @@ mpssas_async(void *callback_arg, uint32_
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.ccb_h.flags = CAM_DIR_IN;
cdai.buftype = CDAI_TYPE_RCAPLONG;
-#if __FreeBSD_version >= 1100061
+#if (__FreeBSD_version >= 1100061) || \
+((__FreeBSD_version >= 1001510) && (__FreeBSD_version < 110))
cdai.flags = CDAI_FLAG_NONE;
 #else
cdai.flags = 0;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r280463 - head/sys/cam/ctl

2015-03-24 Thread Kenneth D. Merry
Author: ken
Date: Tue Mar 24 21:42:28 2015
New Revision: 280463
URL: https://svnweb.freebsd.org/changeset/base/280463

Log:
  Remove some #if 0'ed code that apparently confuses cscope.
  
  Requested by: Peter Xu 
  MFC after:3 days

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Tue Mar 24 21:32:49 2015(r280462)
+++ head/sys/cam/ctl/ctl.c  Tue Mar 24 21:42:28 2015(r280463)
@@ -12152,9 +12152,6 @@ ctl_lun_reset(struct ctl_lun *lun, union
/*
 * Run through the OOA queue and abort each I/O.
 */
-#if 0
-   TAILQ_FOREACH((struct ctl_io_hdr *)xio, &lun->ooa_queue, ooa_links) {
-#endif
for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL;
 xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) {
xio->io_hdr.flags |= CTL_FLAG_ABORT | CTL_FLAG_ABORT_STATUS;
@@ -12335,9 +12332,6 @@ ctl_abort_task(union ctl_io *io)
 * untagged command to abort, simply abort the first untagged command
 * we come to.  We only allow one untagged command at a time of course.
 */
-#if 0
-   TAILQ_FOREACH((struct ctl_io_hdr *)xio, &lun->ooa_queue, ooa_links) {
-#endif
for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL;
 xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) {
 #if 0
@@ -12375,7 +12369,7 @@ ctl_abort_task(union ctl_io *io)
 #if 0
if (((xio->scsiio.tag_type == CTL_TAG_UNTAGGED)
  && (io->taskio.tag_type == CTL_TAG_UNTAGGED))
-|| (xio->scsiio.tag_num == io->taskio.tag_num)) {
+|| (xio->scsiio.tag_num == io->taskio.tag_num))
 #endif
/*
 * XXX KDM we've got problems with FC, because it
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-03-26 Thread Kenneth D. Merry
Author: ken
Date: Fri Mar 27 00:42:51 2015
New Revision: 280722
URL: https://svnweb.freebsd.org/changeset/base/280722

Log:
  MFC revision 280463
  

r280463 | ken | 2015-03-24 15:42:28 -0600 (Tue, 24 Mar 2015) | 5 lines
  
Remove some #if 0'ed code that apparently confuses cscope.
  
Requested by:   Peter Xu 
MFC after:  3 days
  

  
  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 Fri Mar 27 00:37:41 2015(r280721)
+++ stable/10/sys/cam/ctl/ctl.c Fri Mar 27 00:42:51 2015(r280722)
@@ -12154,9 +12154,6 @@ ctl_lun_reset(struct ctl_lun *lun, union
/*
 * Run through the OOA queue and abort each I/O.
 */
-#if 0
-   TAILQ_FOREACH((struct ctl_io_hdr *)xio, &lun->ooa_queue, ooa_links) {
-#endif
for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL;
 xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) {
xio->io_hdr.flags |= CTL_FLAG_ABORT | CTL_FLAG_ABORT_STATUS;
@@ -12337,9 +12334,6 @@ ctl_abort_task(union ctl_io *io)
 * untagged command to abort, simply abort the first untagged command
 * we come to.  We only allow one untagged command at a time of course.
 */
-#if 0
-   TAILQ_FOREACH((struct ctl_io_hdr *)xio, &lun->ooa_queue, ooa_links) {
-#endif
for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL;
 xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) {
 #if 0
@@ -12377,7 +12371,7 @@ ctl_abort_task(union ctl_io *io)
 #if 0
if (((xio->scsiio.tag_type == CTL_TAG_UNTAGGED)
  && (io->taskio.tag_type == CTL_TAG_UNTAGGED))
-|| (xio->scsiio.tag_num == io->taskio.tag_num)) {
+|| (xio->scsiio.tag_num == io->taskio.tag_num))
 #endif
/*
 * XXX KDM we've got problems with FC, because it
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r277917 - in head/sys/cam: ctl scsi

2015-01-29 Thread Kenneth D. Merry
Author: ken
Date: Fri Jan 30 05:23:39 2015
New Revision: 277917
URL: https://svnweb.freebsd.org/changeset/base/277917

Log:
  Improve SCSI Extended Inquiry VPD page (0x86) support.
  
  sys/cam/scsi/scsi_all.h:
In struct scsi_extended_inquiry_data:
- Increase the length field to 2 bytes, as it is 2 bytes in SPC-4.
- Add bit definitions for the various Activiate Microcode actions.
- Add the Sequential Access Logical Block Protection support bit,
  since we need that in the sa(4) driver.  (For modifications
  that will come later.)
- Add definitions for the various Multi I_T Nexus Microcode
  Download modes.
  
  sys/cam/ctl/ctl.c:
As of SPC-4, a single report of "REPORTED LUNS DATA HAS CHANGED"
is to be given per I_T nexus.  Once it is reported, the unit
attention condition should be cleared for all LUNS attached to
an I_T nexus.
  
Previously that only happened when a REPORT LUNS command was
processed.
  
This behavior may be different (according to SAM-5) when the
UA_INTLCK_CTRL bits are non-zero in the control mode page but
CTL does not currently support that.
  
So, in view of the spec, whenever we report a LUN inventory
change unit attention, clear it on all LUNs for that
particular I_T nexus.
  
Add a new function, ctl_clear_ua() that will clear a unit
attention on all LUNs for the given I_T nexus.
  
One field in the extended inquiry data that we could potentially
report at some point is the maximum supported sense data length.
To do that, we would the SIM to report (via path inquiry
perhaps) how much sense data it is able to send.
  
Add comments to explain some of the bits that are set in the
Extended Inquiry VPD page.
  
Add a few comments to make it more clear which functions handle
various VPD pages.
  
  Sponsored by: Spectra Logic
  MFC after:1 week

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

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Fri Jan 30 05:14:01 2015(r277916)
+++ head/sys/cam/ctl/ctl.c  Fri Jan 30 05:23:39 2015(r277917)
@@ -31,7 +31,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl.c#8 $
+ * $Id$
  */
 /*
  * CAM Target Layer, a SCSI device emulation subsystem.
@@ -446,6 +446,8 @@ static int ctl_scsiio_lun_check(struct c
struct ctl_scsiio *ctsio);
 //static int ctl_check_rtr(union ctl_io *pending_io, struct ctl_softc *softc);
 static void ctl_failover(void);
+static void ctl_clear_ua(struct ctl_softc *ctl_softc, uint32_t initidx,
+ctl_ua_type ua_type);
 static int ctl_scsiio_precheck(struct ctl_softc *ctl_softc,
   struct ctl_scsiio *ctsio);
 static int ctl_scsiio(struct ctl_scsiio *ctsio);
@@ -9433,6 +9435,7 @@ ctl_request_sense(struct ctl_scsiio *cts
 {
struct scsi_request_sense *cdb;
struct scsi_sense_data *sense_ptr;
+   struct ctl_softc *ctl_softc;
struct ctl_lun *lun;
uint32_t initidx;
int have_error;
@@ -9441,6 +9444,7 @@ ctl_request_sense(struct ctl_scsiio *cts
 
cdb = (struct scsi_request_sense *)ctsio->cdb;
 
+   ctl_softc = control_softc;
lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
 
CTL_DEBUG_PRINT(("ctl_request_sense\n"));
@@ -9526,6 +9530,14 @@ ctl_request_sense(struct ctl_scsiio *cts
ua_type = ctl_build_ua(lun, initidx, sense_ptr, sense_format);
if (ua_type != CTL_UA_NONE)
have_error = 1;
+   if (ua_type == CTL_UA_LUN_CHANGE) {
+   mtx_unlock(&lun->lun_lock);
+   mtx_lock(&ctl_softc->ctl_lock);
+   ctl_clear_ua(ctl_softc, initidx, ua_type);
+   mtx_unlock(&ctl_softc->ctl_lock);
+   mtx_lock(&lun->lun_lock);
+   }
+
}
mtx_unlock(&lun->lun_lock);
 
@@ -9593,6 +9605,9 @@ ctl_cmddt_inquiry(struct ctl_scsiio *cts
 }
 #endif
 
+/*
+ * SCSI VPD page 0x00, the Supported VPD Pages page.
+ */
 static int
 ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len)
 {
@@ -9665,6 +9680,9 @@ ctl_inquiry_evpd_supported(struct ctl_sc
return (CTL_RETVAL_COMPLETE);
 }
 
+/*
+ * SCSI VPD page 0x80, the Unit Serial Number page.
+ */
 static int
 ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len)
 {
@@ -9721,6 +9739,9 @@ ctl_inquiry_evpd_serial(struct ctl_scsii
 }
 
 
+/*
+ * SCSI VPD page 0x86, the Extended INQUIRY Data page.
+ */
 static int
 ctl_inquiry_evpd_eid(struct ctl_scsiio *ctsio,

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

2015-02-03 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb  3 21:54:59 2015
New Revision: 278169
URL: https://svnweb.freebsd.org/changeset/base/278169

Log:
  MFC 276831:
  
r276831 | ken | 2015-01-08 09:27:56 -0700 (Thu, 08 Jan 2015) | 30 lines
  
Fix a bug in the CAM SCSI probe code that caused changes in inquiry
data to go undetected.
  
The probe code does an MD5 checksum of the inquiry data (and page
0x80 serial number if available) before doing a reprobe of an
existing device, and then compares a checksum after the probe to
see whether the device has changed.
  
This check was broken in January, 2000 by change 56146 when the extended
inquiry probe code was added.
  
In the extended inquiry probe case, it was calculating the checksum
a second time.  The second time it included the updated inquiry
data from the short inquiry probe (first 36 bytes).  So it wouldn't
catch cases where the vendor, product, revision, etc. changed.
  
This change will have the effect that when a device's inquiry data is
updated and a rescan is issued, it will disappear and then reappear.
This is the appropriate action, because if the inquiry data or serial
number changes, it is either a different device or the device
configuration may have changed significantly.  (e.g. with updated
firmware.)
  
scsi_xpt.c: Don't calculate the initial MD5 checksum on
standard inquiry data and the page 0x80 serial
number if we have already calculated it.
  
  Sponsored by: Spectra Logic

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

Modified: stable/10/sys/cam/scsi/scsi_xpt.c
==
--- stable/10/sys/cam/scsi/scsi_xpt.c   Tue Feb  3 20:08:05 2015
(r278168)
+++ stable/10/sys/cam/scsi/scsi_xpt.c   Tue Feb  3 21:54:59 2015
(r278169)
@@ -758,7 +758,8 @@ again:
 * serial number check finish, we attempt to figure out
 * whether we still have the same device.
 */
-   if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) {
+   if (((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0)
+&& ((softc->flags & PROBE_INQUIRY_CKSUM) == 0)) {
 
MD5Init(&softc->context);
MD5Update(&softc->context, (unsigned char *)inq_buf,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r278170 - in stable/10: sbin/camcontrol sys/cam/scsi

2015-02-03 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb  3 22:18:48 2015
New Revision: 278170
URL: https://svnweb.freebsd.org/changeset/base/278170

Log:
  MFC r276835:
  
r276835 | ken | 2015-01-08 09:58:40 -0700 (Thu, 08 Jan 2015) | 91 lines
  
Improve camcontrol(8) handling of drive defect data.
  
This includes a new summary mode (-s) for camcontrol defects that
quickly tells the user the most important thing: how many defects
are in the requested list.  The actual location of the defects is
less important.
  
Modern drives frequently have more than the 8191 defects that can
be reported by the READ DEFECT DATA (10) command.  If they don't
have that many grown defects, they certainly have more than 8191
defects in the primary (i.e. factory) defect list.
  
The READ DEFECT DATA (12) command allows for longer parameter
lists, as well as indexing into the list of defects, and so allows
reporting many more defects.
  
This has been tested with HGST drives and Seagate drives, but
does not fully work with Seagate drives.  Once I have a Seagate
spec I may be able to determine whether it is possible to make it
work with Seagate drives.
  
scsi_da.h:  Add a definition for the new long block defect
format.
  
Add bit and mask definitions for the new extended
physical sector and bytes from index defect
formats.
  
Add a prototype for the new scsi_read_defects() CDB
building function.
  
scsi_da.c:  Add a new scsi_read_defects() CDB building function.
camcontrol(8) was previously composing CDBs manually.
This is long overdue.
  
camcontrol.c:   Revamp the camcontrol defects subcommand.  We now
go through multiple stages in trying to get defect
data off the drive while avoiding various drive
firmware quirks.
  
We start off by requesting the defect header with
the 10 byte command.  If we're in summary mode (-s)
and the drive reports fewer defects than can be
represented in the 10 byte header, we're done.
Otherwise, we know that we need to issue the
12 byte command if the drive reports the maximum
number of defects.
  
If we're in summary mode, we're done if we get a
good response back when asking for the 12 byte header.
  
If the user has asked for the full list, then we
use the address descriptor index field in the 12
byte CDB to step through the list in 64K chunks.
64K is small enough to work with most any ancient
or modern SCSI controller.
  
Add support for printing the new long block defect
format, as well as the extended physical sector and
bytes from index formats.  I don't have any drives
that support the new formats.
  
Add a hexadecimal output format that can be turned
on with -X.
  
Add a quiet mode (-q) that can be turned on with
the summary mode (-s) to just print out a number.
  
Revamp the error detection and recovery code for
the defects command to work with HGST drives.
  
Call the new scsi_read_defects() CDB building
function instead of rolling the CDB ourselves.
  
Pay attention to the residual from the defect list
request when printing it out, so we don't run off
the end of the list.
  
Use the new scsi_nv library routines to convert
from strings to numbers and back.
  
camcontrol.8:   Document the new defect formats (longblock, extbfi,
extphys) and command line options (-q, -s, -S and
-X) for the defects subcommand.
  
Explain a little more about what drives generally
do and don't support.
  
  Sponsored by: Spectra Logic

Modified:
  stable/10/sbin/camcontrol/camcontrol.8
  stable/10/sbin/camcontrol/camcontrol.c
  stable/10/sys/cam/scsi/scsi_da.c
  stable/10/sys/cam/scsi/scsi_da.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/camcontrol/camcontrol.8
==
--- stable/10/sbin/camcontrol/camcontrol.8  Tue Feb  3 21:54:59 2015
(r278169)
+++ stable/10/sbin/camcontrol/camcontrol.8  Tue Feb  3 22:18:48 2015
(r278170)
@@ -110,6 +110,10 @@
 .Aq Fl f Ar format
 .Op Fl P
 .Op Fl G
+.Op Fl q
+.Op Fl s
+.Op Fl S Ar offset
+.Op Fl X
 .Nm
 .Ic modepage
 .Op device id
@@ -513,18 +517,16 @@ connecting to that device.
 Note that this can have a destructive impact
 on the system.
 .It Ic defects
-Send t

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

2015-02-03 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb  3 22:49:12 2015
New Revision: 278171
URL: https://svnweb.freebsd.org/changeset/base/278171

Log:
  MFC isp(4) driver changes:
  
  r276839, r276842, r277513, r277514, r277515
  

r276839 | ken | 2015-01-08 10:41:28 -0700 (Thu, 08 Jan 2015) | 49 lines
  
Fix Fibre Channel Command Reference Number handling in the isp(4) driver.
  
The Command Reference Number is used for precise delivery of
commands, and is part of the FC-Tape functionality set.  (This is
only enabled for devices that support precise delivery of commands.)
It is an 8-bit unsigned number that increments from 1 to 255.  The
commands sent by the initiator must be processed by the target in
CRN order if the CRN is non-zero.
  
There are certain scenarios where the Command Reference Number
sequence needs to be reset.  When the target is power cycled, for
instance, the initiator needs to reset the CRN to 1.  The initiator
will know this because it will see a LIP (when directly connected)
or get a logout/login event (when connected to a switch).
  
The isp(4) driver was not resetting the CRN when a target
went away and came back.  When it saw the target again after a
power cycle, it would continue the CRN sequence where it left off.
The target would ignore the command because the CRN sequence is
supposed to be reset to 1 after a power cycle or other similar
event.
  
The symptom that the user would see is that there would be lots of
aborted INQUIRY commands after a tape library was power cycled, and
the library would fail to probe.  The INQUIRY commands were being
ignored by the tape drive due to the CRN issue mentioned above.
  
isp_freebsd.c:
Add a new function, isp_fcp_reset_crn().  This will reset
all of the CRNs for a given port, or the CRNs for all LUNs
on a target.
  
Reset the CRNs for all targets on a port when we get a LIP,
loop reset, or loop down event.
  
Reset the CRN for a particular target when it arrives, is changed
or departs.  This is less precise behavior than the
clearing behavior specified in the FCP-4 spec (which says
that it should be reset for PRLI, PRLO, PLOGI and LOGO),
but this is the level of information we have here.  If this
is insufficient, then we will need to add more precise
notification from the lower level isp(4) code.
  
isp_freebsd.h:
Add a prototype for isp_fcp_reset_crn().
  
Sponsored by:   Spectra Logic
MFC after:  1 week
  

r276842 | ken | 2015-01-08 10:51:12 -0700 (Thu, 08 Jan 2015) | 44 lines
  
Close a race in the isp(4) driver that caused devices to disappear
and not automatically come back if they were gone for a short
period of time.
  
The isp(4) driver has a 30 second gone device timer that gets
activated whenever a device goes away.  If the device comes back
before the timer expires, we don't send a notification to CAM that
it has gone away.  If, however, there is a command sent to the
device while it is gone and before it comes back, the isp(4) driver
sends the command back with CAM_SEL_TIMEOUT status.
  
CAM responds to the CAM_SEL_TIMEOUT status by removing the device.
In the case where a device comes back within the 30 second gone
device timer window, though, we weren't telling CAM the device
came back.
  
So, fix this by tracking whether we have told CAM the device is
gone, and if we have, send a rescan if it comes back within the 30
second window.
  
ispvar.h:
In the fcportdb_t structure, add a new bitfield,
reported_gone.  This gets set whenever we return a command
with CAM_SEL_TIMEOUT status on a Fibre Channel device.
  
isp_freebsd.c:
In isp_done(), if we're sending CAM_SEL_TIMEOUT for for a
command sent to a FC device, set the reported_gone bit.
  
In isp_async(), in the ISPASYNC_DEV_STAYED case, rescan the
device in question if it is mapped to a target ID and has
been reported gone.
  
In isp_make_here(), take a port database entry argument,
and clear the reported_gone bit when we send a rescan to
CAM.
  
In isp_make_gone(), take a port database entry as an
argument, and set the reported_gone bit when we send an
async event telling CAM consumers that the device is gone.
  
Sponsored by:   Spectra Logic
MFC after:  1 week
  

r277514 | will | 2015-01-21 13:27:11 -0700 (Wed, 21 Jan 2015) | 18 lines
  
Force commit to record the correct log for r277513.
  
If the user sends an XPT_RESET_DEV CCB, make sure to reset the

svn commit: r278228 - in head/sys: cam cam/scsi sys

2015-02-04 Thread Kenneth D. Merry
Author: ken
Date: Thu Feb  5 00:12:21 2015
New Revision: 278228
URL: https://svnweb.freebsd.org/changeset/base/278228

Log:
  Add support for probing the SCSI VPD Extended Inquiry page (0x86).
  
  This VPD page is effectively an extension of the standard Inquiry
  data page, and includes lots of additional bits.
  
  This commit includes support for probing the page in the SCSI probe code,
  and an additional request type for the XPT_DEV_ADVINFO CCB.  CTL already
  supports the Extended Inquiry page.
  
  Support for querying this page in the sa(4) driver will come later.
  
  sys/cam/scsi/scsi_xpt.c:
Probe the Extended Inquiry page, if the device supports it, and
return it in response to a XPT_DEV_ADVINFO CCB if it is requested.
  
  sys/cam/scsi/cam_ccb.h:
Define a new advanced information CCB data type, CDAI_TYPE_EXT_INQ.
  
  sys/cam/cam_xpt.c:
Free the extended inquiry data in a device when the device goes
away.
  
  sys/cam/cam_xpt_internal.h:
Add an extended inquiry data pointer and length to struct cam_ed.
  
  sys/sys/param.h
Bump __FreeBSD_version for the addition of the new
CDAI_TYPE_EXT_INQ advanced information type.
  
  Sponsored by: Spectra Logic
  MFC after:1 week

Modified:
  head/sys/cam/cam_ccb.h
  head/sys/cam/cam_xpt.c
  head/sys/cam/cam_xpt_internal.h
  head/sys/cam/scsi/scsi_xpt.c
  head/sys/sys/param.h

Modified: head/sys/cam/cam_ccb.h
==
--- head/sys/cam/cam_ccb.h  Thu Feb  5 00:11:05 2015(r278227)
+++ head/sys/cam/cam_ccb.h  Thu Feb  5 00:12:21 2015(r278228)
@@ -1147,6 +1147,7 @@ struct ccb_dev_advinfo {
 #defineCDAI_TYPE_SERIAL_NUM2
 #defineCDAI_TYPE_PHYS_PATH 3
 #defineCDAI_TYPE_RCAPLONG  4
+#defineCDAI_TYPE_EXT_INQ   5
off_t bufsiz;   /* IN: Size of external buffer */
 #defineCAM_SCSI_DEVID_MAXLEN   65536   /* length in buffer is an 
uint16_t */
off_t provsiz;  /* OUT: Size required/used */

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Feb  5 00:11:05 2015(r278227)
+++ head/sys/cam/cam_xpt.c  Thu Feb  5 00:12:21 2015(r278228)
@@ -4795,6 +4795,7 @@ xpt_release_device(struct cam_ed *device
 */
free(device->supported_vpds, M_CAMXPT);
free(device->device_id, M_CAMXPT);
+   free(device->ext_inq, M_CAMXPT);
free(device->physpath, M_CAMXPT);
free(device->rcap_buf, M_CAMXPT);
free(device->serial_num, M_CAMXPT);

Modified: head/sys/cam/cam_xpt_internal.h
==
--- head/sys/cam/cam_xpt_internal.h Thu Feb  5 00:11:05 2015
(r278227)
+++ head/sys/cam/cam_xpt_internal.h Thu Feb  5 00:12:21 2015
(r278228)
@@ -83,6 +83,8 @@ struct cam_ed {
uint8_t  supported_vpds_len;
uint32_t device_id_len;
uint8_t  *device_id;
+   uint32_t ext_inq_len;
+   uint8_t  *ext_inq;
uint8_t  physpath_len;
uint8_t  *physpath; /* physical path string form */
uint32_t rcap_len;

Modified: head/sys/cam/scsi/scsi_xpt.c
==
--- head/sys/cam/scsi/scsi_xpt.cThu Feb  5 00:11:05 2015
(r278227)
+++ head/sys/cam/scsi/scsi_xpt.cThu Feb  5 00:12:21 2015
(r278228)
@@ -139,6 +139,7 @@ typedef enum {
PROBE_MODE_SENSE,
PROBE_SUPPORTED_VPD_LIST,
PROBE_DEVICE_ID,
+   PROBE_EXTENDED_INQUIRY,
PROBE_SERIAL_NUM,
PROBE_TUR_FOR_NEGOTIATION,
PROBE_INQUIRY_BASIC_DV1,
@@ -156,6 +157,7 @@ static char *probe_action_text[] = {
"PROBE_MODE_SENSE",
"PROBE_SUPPORTED_VPD_LIST",
"PROBE_DEVICE_ID",
+   "PROBE_EXTENDED_INQUIRY",
"PROBE_SERIAL_NUM",
"PROBE_TUR_FOR_NEGOTIATION",
"PROBE_INQUIRY_BASIC_DV1",
@@ -923,6 +925,34 @@ done:
}
goto done;
}
+   case PROBE_EXTENDED_INQUIRY:
+   {
+   struct scsi_vpd_extended_inquiry_data *ext_inq;
+
+   ext_inq = NULL;
+   if (scsi_vpd_supported_page(periph, SVPD_EXTENDED_INQUIRY_DATA))
+   ext_inq = malloc(sizeof(*ext_inq), M_CAMXPT,
+   M_NOWAIT | M_ZERO);
+
+   if (ext_inq != NULL) {
+   scsi_inquiry(csio,
+/*retries*/4,
+probedone,
+MSG_SIMPLE_Q_TAG,
+(uint8_t *)ext_inq,
+sizeof(*ext_inq),
+   

svn commit: r278964 - in head: sbin/camcontrol sys/cam sys/cam/scsi sys/dev/mpr sys/dev/mps sys/sys

2015-02-18 Thread Kenneth D. Merry
Author: ken
Date: Wed Feb 18 18:30:19 2015
New Revision: 278964
URL: https://svnweb.freebsd.org/changeset/base/278964

Log:
  Make sure that the flags for the XPT_DEV_ADVINFO CCB are initialized
  properly.
  
  If there is garbage in the flags field, it can sometimes include a
  set CDAI_FLAG_STORE flag, which may cause either an error or
  perhaps result in overwriting the field that was intended to be
  read.
  
  sys/cam/cam_ccb.h:
Add a new flag to the XPT_DEV_ADVINFO CCB, CDAI_FLAG_NONE,
that callers can use to set the flags field when no store
is desired.
  
  sys/cam/scsi/scsi_enc_ses.c:
In ses_setphyspath_callback(), explicitly set the
XPT_DEV_ADVINFO flags to CDAI_FLAG_NONE when fetching the
physical path information.  Instead of ORing in the
CDAI_FLAG_STORE flag when storing the physical path, set
the flags field to CDAI_FLAG_STORE.
  
  sys/cam/scsi/scsi_sa.c:
Set the XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE when
fetching extended inquiry information.
  
  sys/cam/scsi/scsi_da.c:
When storing extended READ CAPACITY information, set the
XPT_DEV_ADVINFO flags field to CDAI_FLAG_STORE instead of
ORing it into a field that isn't initialized.
  
  sys/dev/mpr/mpr_sas.c,
  sys/dev/mps/mps_sas.c:
When fetching extended READ CAPACITY information, set the
XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE instead of
setting it to 0.
  
  sbin/camcontrol/camcontrol.c:
When fetching a device ID, set the XPT_DEV_ADVINFO flags
field to CDAI_FLAG_NONE instead of 0.
  
  sys/sys/param.h:
Bump __FreeBSD_version to 1100061 for the new XPT_DEV_ADVINFO
CCB flag, CDAI_FLAG_NONE.
  
  Sponsored by: Spectra Logic
  MFC after:1 week

Modified:
  head/sbin/camcontrol/camcontrol.c
  head/sys/cam/cam_ccb.h
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_enc_ses.c
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mps/mps_sas.c
  head/sys/sys/param.h

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Wed Feb 18 18:12:06 2015
(r278963)
+++ head/sbin/camcontrol/camcontrol.c   Wed Feb 18 18:30:19 2015
(r278964)
@@ -7404,7 +7404,7 @@ getdevid(struct cam_devitem *item)
 retry:
ccb->ccb_h.func_code = XPT_DEV_ADVINFO;
ccb->ccb_h.flags = CAM_DIR_IN;
-   ccb->cdai.flags = 0;
+   ccb->cdai.flags = CDAI_FLAG_NONE;
ccb->cdai.buftype = CDAI_TYPE_SCSI_DEVID;
ccb->cdai.bufsiz = item->device_id_len;
if (item->device_id_len != 0)

Modified: head/sys/cam/cam_ccb.h
==
--- head/sys/cam/cam_ccb.h  Wed Feb 18 18:12:06 2015(r278963)
+++ head/sys/cam/cam_ccb.h  Wed Feb 18 18:30:19 2015(r278964)
@@ -1140,6 +1140,7 @@ struct ccb_eng_exec { /* This structure 
 struct ccb_dev_advinfo {
struct ccb_hdr ccb_h;
uint32_t flags;
+#defineCDAI_FLAG_NONE  0x0 /* No flags set */
 #defineCDAI_FLAG_STORE 0x1 /* If set, action becomes store 
*/
uint32_t buftype;   /* IN: Type of data being requested */
/* NB: buftype is interpreted on a per-transport basis */

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Wed Feb 18 18:12:06 2015(r278963)
+++ head/sys/cam/scsi/scsi_da.c Wed Feb 18 18:30:19 2015(r278964)
@@ -3787,7 +3787,7 @@ dasetgeom(struct cam_periph *periph, uin
xpt_setup_ccb(&cdai.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.buftype = CDAI_TYPE_RCAPLONG;
-   cdai.flags |= CDAI_FLAG_STORE;
+   cdai.flags = CDAI_FLAG_STORE;
cdai.bufsiz = rcap_len;
cdai.buf = (uint8_t *)rcaplong;
xpt_action((union ccb *)&cdai);

Modified: head/sys/cam/scsi/scsi_enc_ses.c
==
--- head/sys/cam/scsi/scsi_enc_ses.cWed Feb 18 18:12:06 2015
(r278963)
+++ head/sys/cam/scsi/scsi_enc_ses.cWed Feb 18 18:30:19 2015
(r278964)
@@ -1007,7 +1007,7 @@ ses_setphyspath_callback(enc_softc_t *en
xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL);
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.buftype = CDAI_TYPE_PHYS_PATH;
-   cdai.flags = 0;
+   cdai.flags = CDAI_FLAG_NONE;
cdai.bufsiz = MAXPATHLEN;
cdai.buf = old_physpath;
xpt_action((union ccb *)&cdai);
@@ -1019,7 +1019,7 @@ ses_setphyspath_callback(enc_softc_t *en
xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL);
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
 

svn commit: r278974 - in stable/10/sys: cam cam/scsi sys

2015-02-18 Thread Kenneth D. Merry
Author: ken
Date: Wed Feb 18 23:08:13 2015
New Revision: 278974
URL: https://svnweb.freebsd.org/changeset/base/278974

Log:
  MFC 278228:
  
  The __FreeBSD_version has been changed to 1001508 for the addition of the
  CDAI_TYPE_EXT_INQ request type.
  

r278228 | ken | 2015-02-04 17:12:21 -0700 (Wed, 04 Feb 2015) | 32 lines
  
Add support for probing the SCSI VPD Extended Inquiry page (0x86).
  
This VPD page is effectively an extension of the standard Inquiry
data page, and includes lots of additional bits.
  
This commit includes support for probing the page in the SCSI probe code,
and an additional request type for the XPT_DEV_ADVINFO CCB.  CTL already
supports the Extended Inquiry page.
  
Support for querying this page in the sa(4) driver will come later.
  
sys/cam/scsi/scsi_xpt.c:
Probe the Extended Inquiry page, if the device supports it, and
return it in response to a XPT_DEV_ADVINFO CCB if it is requested.
  
sys/cam/scsi/cam_ccb.h:
Define a new advanced information CCB data type, CDAI_TYPE_EXT_INQ.
  
sys/cam/cam_xpt.c:
Free the extended inquiry data in a device when the device goes
away.
  
sys/cam/cam_xpt_internal.h:
Add an extended inquiry data pointer and length to struct cam_ed.
  
sys/sys/param.h
Bump __FreeBSD_version for the addition of the new
CDAI_TYPE_EXT_INQ advanced information type.
  
Sponsored by:   Spectra Logic
MFC after:  1 week
  

  
  Sponsored by: Spectra Logic

Modified:
  stable/10/sys/cam/cam_ccb.h
  stable/10/sys/cam/cam_xpt.c
  stable/10/sys/cam/cam_xpt_internal.h
  stable/10/sys/cam/scsi/scsi_xpt.c
  stable/10/sys/sys/param.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/cam_ccb.h
==
--- stable/10/sys/cam/cam_ccb.h Wed Feb 18 22:29:52 2015(r278973)
+++ stable/10/sys/cam/cam_ccb.h Wed Feb 18 23:08:13 2015(r278974)
@@ -1152,6 +1152,7 @@ struct ccb_dev_advinfo {
 #defineCDAI_TYPE_SERIAL_NUM2
 #defineCDAI_TYPE_PHYS_PATH 3
 #defineCDAI_TYPE_RCAPLONG  4
+#defineCDAI_TYPE_EXT_INQ   5
off_t bufsiz;   /* IN: Size of external buffer */
 #defineCAM_SCSI_DEVID_MAXLEN   65536   /* length in buffer is an 
uint16_t */
off_t provsiz;  /* OUT: Size required/used */

Modified: stable/10/sys/cam/cam_xpt.c
==
--- stable/10/sys/cam/cam_xpt.c Wed Feb 18 22:29:52 2015(r278973)
+++ stable/10/sys/cam/cam_xpt.c Wed Feb 18 23:08:13 2015(r278974)
@@ -4793,6 +4793,7 @@ xpt_release_device(struct cam_ed *device
 */
free(device->supported_vpds, M_CAMXPT);
free(device->device_id, M_CAMXPT);
+   free(device->ext_inq, M_CAMXPT);
free(device->physpath, M_CAMXPT);
free(device->rcap_buf, M_CAMXPT);
free(device->serial_num, M_CAMXPT);

Modified: stable/10/sys/cam/cam_xpt_internal.h
==
--- stable/10/sys/cam/cam_xpt_internal.hWed Feb 18 22:29:52 2015
(r278973)
+++ stable/10/sys/cam/cam_xpt_internal.hWed Feb 18 23:08:13 2015
(r278974)
@@ -83,6 +83,8 @@ struct cam_ed {
uint8_t  supported_vpds_len;
uint32_t device_id_len;
uint8_t  *device_id;
+   uint32_t ext_inq_len;
+   uint8_t  *ext_inq;
uint8_t  physpath_len;
uint8_t  *physpath; /* physical path string form */
uint32_t rcap_len;

Modified: stable/10/sys/cam/scsi/scsi_xpt.c
==
--- stable/10/sys/cam/scsi/scsi_xpt.c   Wed Feb 18 22:29:52 2015
(r278973)
+++ stable/10/sys/cam/scsi/scsi_xpt.c   Wed Feb 18 23:08:13 2015
(r278974)
@@ -142,6 +142,7 @@ typedef enum {
PROBE_MODE_SENSE,
PROBE_SUPPORTED_VPD_LIST,
PROBE_DEVICE_ID,
+   PROBE_EXTENDED_INQUIRY,
PROBE_SERIAL_NUM,
PROBE_TUR_FOR_NEGOTIATION,
PROBE_INQUIRY_BASIC_DV1,
@@ -159,6 +160,7 @@ static char *probe_action_text[] = {
"PROBE_MODE_SENSE",
"PROBE_SUPPORTED_VPD_LIST",
"PROBE_DEVICE_ID",
+   "PROBE_EXTENDED_INQUIRY",
"PROBE_SERIAL_NUM",
"PROBE_TUR_FOR_NEGOTIATION",
"PROBE_INQUIRY_BASIC_DV1",
@@ -926,6 +928,34 @@ done:
}
goto done;
}
+   case PROBE_EXTENDED_INQUIRY:
+   {
+   struct scsi_vpd_extended_inquiry_data *ext_inq;
+
+   ext_inq = NULL;
+   if (scsi_vpd_su

svn commit: r279219 - in head: contrib/groff/tmac lib lib/libmt rescue/rescue share/man/man4 share/mk sys/cam/scsi sys/sys usr.bin/mt

2015-02-23 Thread Kenneth D. Merry
Author: ken
Date: Mon Feb 23 21:59:30 2015
New Revision: 279219
URL: https://svnweb.freebsd.org/changeset/base/279219

Log:
  Significant upgrades to sa(4) and mt(1).
  
  The primary focus of these changes is to modernize FreeBSD's
  tape infrastructure so that we can take advantage of some of the
  features of modern tape drives and allow support for LTFS.
  
  Significant changes and new features include:
  
   o sa(4) driver status and parameter information is now exported via an
 XML structure.  This will allow for changes and improvements later
 on that will not break userland applications.  The old MTIOCGET
 status ioctl remains, so applications using the existing interface
 will not break.
  
   o 'mt status' now reports drive-reported tape position information
 as well as the previously available calculated tape position
 information.  These numbers will be different at times, because
 the drive-reported block numbers are relative to BOP (Beginning
 of Partition), but the block numbers calculated previously via
 sa(4) (and still provided) are relative to the last filemark.
 Both numbers are now provided.  'mt status' now also shows the
 drive INQUIRY information, serial number and any position flags
 (BOP, EOT, etc.) provided with the tape position information.
 'mt status -v' adds information on the maximum possible I/O size,
 and the underlying values used to calculate it.
  
   o The extra sa(4) /dev entries (/dev/saN.[0-3]) have been removed.
  
 The extra devices were originally added as place holders for
 density-specific device nodes.  Some OSes (NetBSD, NetApp's OnTap
 and Solaris) have had device nodes that, when you write to them,
 will automatically select a given density for particular tape drives.
  
 This is a convenient way of switching densities, but it was never
 implemented in FreeBSD.  Only the device nodes were there, and that
 sometimes confused users.
  
 For modern tape devices, the density is generally not selectable
 (e.g. with LTO) or defaults to the highest availble density when
 the tape is rewritten from BOT (e.g. TS11X0).  So, for most users,
 density selection won't be necessary.  If they do need to select
 the density, it is easy enough to use 'mt density' to change it.
  
   o Protection information is now supported.  This is either a
 Reed-Solomon CRC or CRC32 that is included at the end of each block
 read and written.  On write, the tape drive verifies the CRC, and
 on read, the tape drive provides a CRC for the userland application
 to verify.
  
   o New, extensible tape driver parameter get/set interface.
  
   o Density reporting information.  For drives that support it,
 'mt getdensity' will show detailed information on what formats the
 tape drive supports, and what formats the tape drive supports.
  
   o Some mt(1) functionality moved into a new mt(3) library so that
 external applications can reuse the code.
  
   o The new mt(3) library includes helper routines to aid in parsing
 the XML output of the sa(4) driver, and build a tree of driver
 metadata.
  
   o Support for the MTLOAD (load a tape in the drive) and MTWEOFI
 (write filemark immediate) ioctls needed by IBM's LTFS
 implementation.
  
   o Improve device departure behavior for the sa(4) driver.  The previous
 implementation led to hangs when the device was open.
  
   o This has been tested on the following types of drives:
IBM TS1150
IBM TS1140
IBM LTO-6
IBM LTO-5
HP LTO-2
Seagate DDS-4
Quantum DLT-4000
Exabyte 8505
Sony DDS-2
  
  contrib/groff/tmac/doc-syms,
  share/mk/bsd.libnames.mk,
  lib/Makefile,
Add libmt.
  
  lib/libmt/Makefile,
  lib/libmt/mt.3,
  lib/libmt/mtlib.c,
  lib/libmt/mtlib.h,
New mt(3) library that contains functions moved from mt(1) and
new functions needed to interact with the updated sa(4) driver.
  
This includes XML parser helper functions that application writers
can use when writing code to query tape parameters.
  
  rescue/rescue/Makefile:
Add -lmt to CRUNCH_LIBS.
  
  src/share/man/man4/mtio.4
Clarify this man page a bit, and since it contains what is
essentially the mtio.h header file, add new ioctls and structure
definitions from mtio.h.
  
  src/share/man/man4/sa.4
Update BUGS and maintainer section.
  
  sys/cam/scsi/scsi_all.c,
  sys/cam/scsi/scsi_all.h:
Add SCSI SECURITY PROTOCOL IN/OUT CDB definitions and CDB building
functions.
  
  sys/cam/scsi/scsi_sa.c
  sys/cam/scsi/scsi_sa.h
Many tape driver changes, largely outlined above.
  
Increase the sa(4) driver read/write timeout from 4 to 32
minutes.  This is based on the recommended values for IBM LTO
5/6 drives.  This may also avoid timeouts for other tape

svn commit: r279221 - head/sys/sys

2015-02-23 Thread Kenneth D. Merry
Author: ken
Date: Mon Feb 23 22:50:43 2015
New Revision: 279221
URL: https://svnweb.freebsd.org/changeset/base/279221

Log:
  Bump __FreeBSD_version for the mtio(4) / sa(4) ioctl and API additions
  in revision 279219.
  
  Sponsored by: Spectra Logic
  MFC after:1 month

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hMon Feb 23 22:31:39 2015(r279220)
+++ head/sys/sys/param.hMon Feb 23 22:50:43 2015(r279221)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1100061  /* Master, propagated to newvers */
+#define __FreeBSD_version 1100062  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-02-23 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb 24 05:43:16 2015
New Revision: 279229
URL: https://svnweb.freebsd.org/changeset/base/279229

Log:
  Fix printf format warnings on sparc64 and mips.
  
  Sponsored by: Spectra Logic
  MFC after:1 month

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

Modified: head/sys/cam/scsi/scsi_sa.c
==
--- head/sys/cam/scsi/scsi_sa.c Tue Feb 24 05:35:15 2015(r279228)
+++ head/sys/cam/scsi/scsi_sa.c Tue Feb 24 05:43:16 2015(r279229)
@@ -4432,7 +4432,7 @@ saextget(struct cdev *dev, struct cam_pe
ts2_len);
 
SASBADDVARSTRDESC(sb, indent, tmpstr2, %s, serial_num,
-   cgd.serial_num_len + 1, "Serial Number");
+   (ssize_t)cgd.serial_num_len + 1, "Serial Number");
if (ts2_malloc != 0)
free(tmpstr2, M_SCSISA);
} else {
@@ -4441,8 +4441,8 @@ saextget(struct cdev *dev, struct cam_pe
 * be empty if the device has no serial number.
 */
tmpstr[0] = '\0';
-   SASBADDVARSTRDESC(sb, indent, tmpstr, %s, serial_num, 0,
-   "Serial Number");
+   SASBADDVARSTRDESC(sb, indent, tmpstr, %s, serial_num,
+   (ssize_t)0, "Serial Number");
}
 
SASBADDUINTDESC(sb, indent, softc->maxio, %u, maxio, 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-02-24 Thread Kenneth D. Merry
Author: ken
Date: Wed Feb 25 04:30:23 2015
New Revision: 279261
URL: https://svnweb.freebsd.org/changeset/base/279261

Log:
  Fix several problems found by Coverity.
  
  lib/libmt/mtlib.c:
In mt_start_element(), make sure we don't overflow the
cur_sb array.  CID 1271325
  
  usr.bin/mt/mt.c:
In main(), bzero the mt_com structure so that we aren't
using any uninitialized stack variables.  CID 1271319
  
In mt_param(), only allow one -s and one -p argument.  This
will prevent a memory leak caused by overwriting the
param_name and/or param_value variables.  CID 1271320 and
CID 1271322
  
To make things simpler in mt_param(), make sure there
there is only one exit path for the function.  Make sure
the arguments are explicitly freed.
  
  Sponsored by: Spectra Logic
  Pointed out by:   emaste
  MFC after:1 month

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

Modified: head/lib/libmt/mtlib.c
==
--- head/lib/libmt/mtlib.c  Wed Feb 25 00:06:25 2015(r279260)
+++ head/lib/libmt/mtlib.c  Wed Feb 25 04:30:23 2015(r279261)
@@ -68,7 +68,7 @@ mt_start_element(void *user_data, const 
return;
 
mtinfo->level++;
-   if ((u_int)mtinfo->level > (sizeof(mtinfo->cur_sb) /
+   if ((u_int)mtinfo->level >= (sizeof(mtinfo->cur_sb) /
 sizeof(mtinfo->cur_sb[0]))) {
mtinfo->error = 1;
 snprintf(mtinfo->error_str, sizeof(mtinfo->error_str), 

Modified: head/usr.bin/mt/mt.c
==
--- head/usr.bin/mt/mt.cWed Feb 25 00:06:25 2015(r279260)
+++ head/usr.bin/mt/mt.cWed Feb 25 04:30:23 2015(r279261)
@@ -212,6 +212,8 @@ main(int argc, char *argv[])
int ch, len, mtfd;
const char *p, *tape;
 
+   bzero(&mt_com, sizeof(mt_com));
+   
if ((tape = getenv("TAPE")) == NULL)
tape = DEFTAPE;
 
@@ -1333,12 +1335,24 @@ mt_param(int argc, char **argv, int mtfd
list = 1;
break;
case 'p':
+   if (param_name != NULL) {
+   warnx("Only one paramter name may be "
+   "specified");
+   retval = 1;
+   goto bailout;
+   }
param_name = strdup(optarg);
break;
case 'q':
quiet = 1;
break;
case 's':
+   if (param_value != NULL) {
+   warnx("Only one paramter value may be "
+   "specified");
+   retval = 1;
+   goto bailout;
+   }
param_value = strdup(optarg);
do_set = 1;
break;
@@ -1350,12 +1364,16 @@ mt_param(int argc, char **argv, int mtfd
}
}
 
-   if ((list + do_set + xml_dump) != 1)
-   errx(1, "You must specify only one of -s, -l or -x");
+   if ((list + do_set + xml_dump) != 1) {
+   warnx("You must specify only one of -s, -l or -x");
+   retval = 1;
+   goto bailout;
+   }
 
if (xml_dump != 0) {
printf("%s", xml_str);
-   return (0);
+   retval = 0;
+   goto bailout;
}
 
if (do_set != 0) {
@@ -1367,6 +1385,9 @@ mt_param(int argc, char **argv, int mtfd
} else if (list != 0)
retval = mt_param_list(status_data, param_name, quiet);
 
+bailout:
+   free(param_name);
+   free(param_value);
return (retval);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r279329 - in stable/10: sbin/camcontrol sys/cam sys/cam/scsi sys/dev/mpr sys/dev/mps sys/sys

2015-02-26 Thread Kenneth D. Merry
Author: ken
Date: Thu Feb 26 20:46:16 2015
New Revision: 279329
URL: https://svnweb.freebsd.org/changeset/base/279329

Log:
  MFC r278964:
  
  The __FreeBSD_version was changed to 1001510 to be appropriate for
  stable/10.
  
  I will followup with a commit to mpr(4) and mps(4) in head to reflect
  the stable/10 __FreeBSD_version and merge the change back to stable/10.
  

r278964 | ken | 2015-02-18 11:30:19 -0700 (Wed, 18 Feb 2015) | 46 lines
  
Make sure that the flags for the XPT_DEV_ADVINFO CCB are initialized
properly.
  
If there is garbage in the flags field, it can sometimes include a
set CDAI_FLAG_STORE flag, which may cause either an error or
perhaps result in overwriting the field that was intended to be
read.
  
sys/cam/cam_ccb.h:
Add a new flag to the XPT_DEV_ADVINFO CCB, CDAI_FLAG_NONE,
that callers can use to set the flags field when no store
is desired.
  
sys/cam/scsi/scsi_enc_ses.c:
In ses_setphyspath_callback(), explicitly set the
XPT_DEV_ADVINFO flags to CDAI_FLAG_NONE when fetching the
physical path information.  Instead of ORing in the
CDAI_FLAG_STORE flag when storing the physical path, set
the flags field to CDAI_FLAG_STORE.
  
sys/cam/scsi/scsi_sa.c:
Set the XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE when
fetching extended inquiry information.
  
sys/cam/scsi/scsi_da.c:
When storing extended READ CAPACITY information, set the
XPT_DEV_ADVINFO flags field to CDAI_FLAG_STORE instead of
ORing it into a field that isn't initialized.
  
sys/dev/mpr/mpr_sas.c,
sys/dev/mps/mps_sas.c:
When fetching extended READ CAPACITY information, set the
XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE instead of
setting it to 0.
  
sbin/camcontrol/camcontrol.c:
When fetching a device ID, set the XPT_DEV_ADVINFO flags
field to CDAI_FLAG_NONE instead of 0.
  
sys/sys/param.h:
Bump __FreeBSD_version to 1100061 for the new XPT_DEV_ADVINFO
CCB flag, CDAI_FLAG_NONE.
  
Sponsored by:   Spectra Logic

Modified:
  stable/10/sbin/camcontrol/camcontrol.c
  stable/10/sys/cam/cam_ccb.h
  stable/10/sys/cam/scsi/scsi_da.c
  stable/10/sys/cam/scsi/scsi_enc_ses.c
  stable/10/sys/dev/mpr/mpr_sas.c
  stable/10/sys/dev/mps/mps_sas.c
  stable/10/sys/sys/param.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/camcontrol/camcontrol.c
==
--- stable/10/sbin/camcontrol/camcontrol.c  Thu Feb 26 20:02:29 2015
(r279328)
+++ stable/10/sbin/camcontrol/camcontrol.c  Thu Feb 26 20:46:16 2015
(r279329)
@@ -7404,7 +7404,7 @@ getdevid(struct cam_devitem *item)
 retry:
ccb->ccb_h.func_code = XPT_DEV_ADVINFO;
ccb->ccb_h.flags = CAM_DIR_IN;
-   ccb->cdai.flags = 0;
+   ccb->cdai.flags = CDAI_FLAG_NONE;
ccb->cdai.buftype = CDAI_TYPE_SCSI_DEVID;
ccb->cdai.bufsiz = item->device_id_len;
if (item->device_id_len != 0)

Modified: stable/10/sys/cam/cam_ccb.h
==
--- stable/10/sys/cam/cam_ccb.h Thu Feb 26 20:02:29 2015(r279328)
+++ stable/10/sys/cam/cam_ccb.h Thu Feb 26 20:46:16 2015(r279329)
@@ -1145,6 +1145,7 @@ struct ccb_eng_exec { /* This structure 
 struct ccb_dev_advinfo {
struct ccb_hdr ccb_h;
uint32_t flags;
+#defineCDAI_FLAG_NONE  0x0 /* No flags set */
 #defineCDAI_FLAG_STORE 0x1 /* If set, action becomes store 
*/
uint32_t buftype;   /* IN: Type of data being requested */
/* NB: buftype is interpreted on a per-transport basis */

Modified: stable/10/sys/cam/scsi/scsi_da.c
==
--- stable/10/sys/cam/scsi/scsi_da.cThu Feb 26 20:02:29 2015
(r279328)
+++ stable/10/sys/cam/scsi/scsi_da.cThu Feb 26 20:46:16 2015
(r279329)
@@ -3784,7 +3784,7 @@ dasetgeom(struct cam_periph *periph, uin
xpt_setup_ccb(&cdai.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.buftype = CDAI_TYPE_RCAPLONG;
-   cdai.flags |= CDAI_FLAG_STORE;
+   cdai.flags = CDAI_FLAG_STORE;
cdai.bufsiz = rcap_len;
cdai.buf = (uint8_t *)rcaplong;
xpt_action((union ccb *)&cdai);

Modified: stable/10/sys/cam/scsi/scsi_enc_ses.c
==
--- stable/10/sys/cam/scsi/scsi_enc_ses.c   Thu Feb 26 20:02:29 2015
(r279328)
+++ stable/10/sys/cam/scsi/scsi_enc_ses.c   Thu Feb 26 20:46:16 2015
(r279329)
@@

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

2015-02-26 Thread Kenneth D. Merry
Author: ken
Date: Thu Feb 26 22:22:06 2015
New Revision: 279336
URL: https://svnweb.freebsd.org/changeset/base/279336

Log:
  Add FreeBSD stable/10 version checks for the availability of the
  CDAI_FLAG_NONE advanced information CCB flag.
  
  Support for the flag was merged to stable/10 in r279329, and the
  __FreeBSD_version in stable/10 was bumped to 1001510.
  
  Check for that version in the mps(4) and mpr(4) drivers when determining
  whether to use the flag.
  
  Sponsored by: Spectra Logic
  MFC after:3 days

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  Thu Feb 26 21:30:40 2015(r279335)
+++ head/sys/dev/mpr/mpr_sas.c  Thu Feb 26 22:22:06 2015(r279336)
@@ -3082,7 +3082,8 @@ mprsas_async(void *callback_arg, uint32_
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.ccb_h.flags = CAM_DIR_IN;
cdai.buftype = CDAI_TYPE_RCAPLONG;
-#if __FreeBSD_version >= 1100061
+#if (__FreeBSD_version >= 1100061) || \
+((__FreeBSD_version >= 1001510) && (__FreeBSD_version < 110))
cdai.flags = CDAI_FLAG_NONE;
 #else
cdai.flags = 0;

Modified: head/sys/dev/mps/mps_sas.c
==
--- head/sys/dev/mps/mps_sas.c  Thu Feb 26 21:30:40 2015(r279335)
+++ head/sys/dev/mps/mps_sas.c  Thu Feb 26 22:22:06 2015(r279336)
@@ -3277,7 +3277,8 @@ mpssas_async(void *callback_arg, uint32_
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.ccb_h.flags = CAM_DIR_IN;
cdai.buftype = CDAI_TYPE_RCAPLONG;
-#if __FreeBSD_version >= 1100061
+#if (__FreeBSD_version >= 1100061) || \
+((__FreeBSD_version >= 1001510) && (__FreeBSD_version < 110))
cdai.flags = CDAI_FLAG_NONE;
 #else
cdai.flags = 0;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r279346 - head/lib/libdevstat

2015-02-26 Thread Kenneth D. Merry
Author: ken
Date: Fri Feb 27 02:44:12 2015
New Revision: 279346
URL: https://svnweb.freebsd.org/changeset/base/279346

Log:
  Remove an obsolete comment in devstat(3) about the accuracy of the
  milliseconds per transaction (DSM_MS_PER_TRANSACTION) calculation.
  
  The comment was accurate many years ago when the kernel didn't
  record I/O times on a per-I/O basis, but now that we do collect
  that information in most areas, it isn't correct.
  
  The milliseconds per transaction values are correct, assuming the
  I/O duration has been recorded.
  
  Sponsored by: Spectra Logic
  MFC after:3 days

Modified:
  head/lib/libdevstat/devstat.c

Modified: head/lib/libdevstat/devstat.c
==
--- head/lib/libdevstat/devstat.c   Fri Feb 27 02:21:52 2015
(r279345)
+++ head/lib/libdevstat/devstat.c   Fri Feb 27 02:44:12 2015
(r279346)
@@ -1487,22 +1487,9 @@ devstat_compute_statistics(struct devsta
*destld = 0.0;
break;
/*
-* This calculation is somewhat bogus.  It simply divides
-* the elapsed time by the total number of transactions
-* completed.  While that does give the caller a good
-* picture of the average rate of transaction completion,
-* it doesn't necessarily give the caller a good view of
-* how long transactions took to complete on average.
-* Those two numbers will be different for a device that
-* can handle more than one transaction at a time.  e.g.
-* SCSI disks doing tagged queueing.
-*
-* The only way to accurately determine the real average
-* time per transaction would be to compute and store the
-* time on a per-transaction basis.  That currently isn't
-* done in the kernel, and would only be desireable if it
-* could be implemented in a somewhat non-intrusive and high
-* performance way.
+* Some devstat callers update the duration and some don't.
+* So this will only be accurate if they provide the
+* duration. 
 */
case DSM_MS_PER_TRANSACTION:
if (totaltransfers > 0) {
@@ -1512,11 +1499,6 @@ devstat_compute_statistics(struct devsta
} else
*destld = 0.0;
break;
-   /*
-* As above, these next two really only give the average
-* rate of completion for read and write transactions, not
-* the average time the transaction took to complete.
-*/
case DSM_MS_PER_TRANSACTION_READ:
if (totaltransfersread > 0) {
*destld = totaldurationread;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r279375 - head/sys/cam

2015-02-27 Thread Kenneth D. Merry
Author: ken
Date: Fri Feb 27 21:35:36 2015
New Revision: 279375
URL: https://svnweb.freebsd.org/changeset/base/279375

Log:
  Fix I/O size calculation for pass(4) driver requests and add latency
  tracking.
  
  It is important to subtract the residual from the requested
  transfer size to see how much data was actually transferred.  With
  tape drives in particular, it is common to request more data than is
  returned.
  
  Also, add I/O latency tracking for CAM requests issued by
  cam_periph_runccb().
  
  If the caller supplies a struct devstat, and the I/O is a SCSI or
  ATA I/O, we will track the elapsed time to provide I/O latency
  statistics for the request.
  
  sys/cam/scsi/cam_periph.c:
In cam_periph_runccb(), subtract the residual when reporting I/O
totals to devstat(9) for SCSI and ATA passthrough requests.
  
In cam_periph_runccb(), grab the I/O start time and supply
the start time to devstat_end_transaction() so that it can
calculate the elapsed I/O time.
  
  Sponsored by: Spectra Logic
  MFC after:1 week

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Fri Feb 27 21:27:02 2015(r279374)
+++ head/sys/cam/cam_periph.c   Fri Feb 27 21:35:36 2015(r279375)
@@ -1048,8 +1048,11 @@ cam_periph_runccb(union ccb *ccb,
  cam_flags camflags, u_int32_t sense_flags,
  struct devstat *ds)
 {
+   struct bintime *starttime;
+   struct bintime ltime;
int error;
  
+   starttime = NULL;
xpt_path_assert(ccb->ccb_h.path, MA_OWNED);
 
/*
@@ -1057,8 +1060,11 @@ cam_periph_runccb(union ccb *ccb,
 * this particular type of ccb, record the transaction start.
 */
if ((ds != NULL) && (ccb->ccb_h.func_code == XPT_SCSI_IO ||
-   ccb->ccb_h.func_code == XPT_ATA_IO))
-   devstat_start_transaction(ds, NULL);
+   ccb->ccb_h.func_code == XPT_ATA_IO)) {
+   starttime = ccb_h.cbfcnp = cam_periph_done;
xpt_action(ccb);
@@ -1086,22 +1092,22 @@ cam_periph_runccb(union ccb *ccb,
if (ds != NULL) {
if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
devstat_end_transaction(ds,
-   ccb->csio.dxfer_len,
+   ccb->csio.dxfer_len - ccb->csio.resid,
ccb->csio.tag_action & 0x3,
((ccb->ccb_h.flags & CAM_DIR_MASK) ==
CAM_DIR_NONE) ?  DEVSTAT_NO_DATA : 
(ccb->ccb_h.flags & CAM_DIR_OUT) ?
DEVSTAT_WRITE : 
-   DEVSTAT_READ, NULL, NULL);
+   DEVSTAT_READ, NULL, starttime);
} else if (ccb->ccb_h.func_code == XPT_ATA_IO) {
devstat_end_transaction(ds,
-   ccb->ataio.dxfer_len,
+   ccb->ataio.dxfer_len - ccb->ataio.resid,
ccb->ataio.tag_action & 0x3,
((ccb->ccb_h.flags & CAM_DIR_MASK) ==
CAM_DIR_NONE) ?  DEVSTAT_NO_DATA : 
(ccb->ccb_h.flags & CAM_DIR_OUT) ?
DEVSTAT_WRITE : 
-   DEVSTAT_READ, NULL, NULL);
+   DEVSTAT_READ, NULL, starttime);
}
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-03-02 Thread Kenneth D. Merry
Author: ken
Date: Mon Mar  2 18:09:49 2015
New Revision: 279534
URL: https://svnweb.freebsd.org/changeset/base/279534

Log:
  Change the sa(4) driver to check for long position support on
  SCSI-2 devices.
  
  Some older tape devices claim to be SCSI-2, but actually do support
  long position information.  (Long position information includes
  the current file mark.)  For example, the COMPAQ SuperDLT1.
  
  So we now only disable the check on SCSI-1 and older devices.
  
  sys/cam/scsi/scsi_sa.c:
In saregister(), only disable fetching long position
information on SCSI-1 and older drives.  Update the
comment to explain why.
  
  Confirmed by: dvl
  Sponsored by: Spectra Logic
  MFC after:3 weeks

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

Modified: head/sys/cam/scsi/scsi_sa.c
==
--- head/sys/cam/scsi/scsi_sa.c Mon Mar  2 18:08:39 2015(r279533)
+++ head/sys/cam/scsi/scsi_sa.c Mon Mar  2 18:09:49 2015(r279534)
@@ -2396,9 +2396,13 @@ saregister(struct cam_periph *periph, vo
 * Long format data for READ POSITION was introduced in SSC, which
 * was after SCSI-2.  (Roughly equivalent to SCSI-3.)  If the drive
 * reports that it is SCSI-2 or older, it is unlikely to support
-* long position data.
+* long position data, but it might.  Some drives from that era
+* claim to be SCSI-2, but do support long position information.
+* So, instead of immediately disabling long position information
+* for SCSI-2 devices, we'll try one pass through sagetpos(), and 
+* then disable long position information if we get an error.   
 */
-   if (cgd->inq_data.version <= SCSI_REV_2)
+   if (cgd->inq_data.version <= SCSI_REV_CCS)
softc->quirks |= SA_QUIRK_NO_LONG_POS;
 
if (cgd->inq_data.spc3_flags & SPC3_SID_PROTECT) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r279545 - stable/10/lib/libdevstat

2015-03-02 Thread Kenneth D. Merry
Author: ken
Date: Mon Mar  2 21:00:54 2015
New Revision: 279545
URL: https://svnweb.freebsd.org/changeset/base/279545

Log:
  MFC r279346:
  

r279346 | ken | 2015-02-26 19:44:12 -0700 (Thu, 26 Feb 2015) | 13 lines
  
Remove an obsolete comment in devstat(3) about the accuracy of the
milliseconds per transaction (DSM_MS_PER_TRANSACTION) calculation.
  
The comment was accurate many years ago when the kernel didn't
record I/O times on a per-I/O basis, but now that we do collect
that information in most areas, it isn't correct.
  
The milliseconds per transaction values are correct, assuming the
I/O duration has been recorded.
  
Sponsored by:   Spectra Logic
  


Modified:
  stable/10/lib/libdevstat/devstat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libdevstat/devstat.c
==
--- stable/10/lib/libdevstat/devstat.c  Mon Mar  2 20:42:06 2015
(r279544)
+++ stable/10/lib/libdevstat/devstat.c  Mon Mar  2 21:00:54 2015
(r279545)
@@ -1480,22 +1480,9 @@ devstat_compute_statistics(struct devsta
*destld = 0.0;
break;
/*
-* This calculation is somewhat bogus.  It simply divides
-* the elapsed time by the total number of transactions
-* completed.  While that does give the caller a good
-* picture of the average rate of transaction completion,
-* it doesn't necessarily give the caller a good view of
-* how long transactions took to complete on average.
-* Those two numbers will be different for a device that
-* can handle more than one transaction at a time.  e.g.
-* SCSI disks doing tagged queueing.
-*
-* The only way to accurately determine the real average
-* time per transaction would be to compute and store the
-* time on a per-transaction basis.  That currently isn't
-* done in the kernel, and would only be desireable if it
-* could be implemented in a somewhat non-intrusive and high
-* performance way.
+* Some devstat callers update the duration and some don't.
+* So this will only be accurate if they provide the
+* duration. 
 */
case DSM_MS_PER_TRANSACTION:
if (totaltransfers > 0) {
@@ -1505,11 +1492,6 @@ devstat_compute_statistics(struct devsta
} else
*destld = 0.0;
break;
-   /*
-* As above, these next two really only give the average
-* rate of completion for read and write transactions, not
-* the average time the transaction took to complete.
-*/
case DSM_MS_PER_TRANSACTION_READ:
if (totaltransfersread > 0) {
*destld = totaldurationread;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-03-03 Thread Kenneth D. Merry
Author: ken
Date: Tue Mar  3 22:49:07 2015
New Revision: 279570
URL: https://svnweb.freebsd.org/changeset/base/279570

Log:
  Add density code for DAT-72, and notes on DAT-160.
  
  As it turns out, the density code for DAT-160 (0x48) is the same
  as for SDLT220.  Since the SDLT values are already in the table,
  we will leave them in place.
  
  Thanks to Harald Schmalzbauer for confirming the DAT-72 density code.
  
  lib/libmt/mtlib.c:
Add DAT-72 density code, and commented out DAT-160 density
code.  Explain why DAT-160 is commented out.  Add notes
explaining where the bpi values for these formats came from.
  
  usr.bin/mt/mt.1:
Add DAT-72 density code, and add a note explaining that
the SDLTTapeI(110) density code (0x48) is the same as
DAT-160.
  
  Sponsored by: Spectra Logic
  MFC after:3 weeks

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

Modified: head/lib/libmt/mtlib.c
==
--- head/lib/libmt/mtlib.c  Tue Mar  3 21:21:43 2015(r279569)
+++ head/lib/libmt/mtlib.c  Tue Mar  3 22:49:07 2015(r279570)
@@ -568,6 +568,15 @@ static struct densities {
 *
 * IBM 3592 definitions obtained from second edition of the IBM
 * System Storage Tape Drive 3592 SCSI Reference (May 25, 2012).
+*
+* DAT-72 and DAT-160 bpi values taken from "HP StorageWorks DAT160
+* tape drive white paper", dated June 2007.
+*
+* DAT-160 / SDLT220 density code (0x48) conflict information
+* found here:
+*
+* 
http://h20564.www2.hp.com/hpsc/doc/public/display?docId=emr_na-c01065117&sp4ts.oid=429311
+* (Document ID c01065117)
 */
/*Num.  bpmmbpi Reference */
{ 0x1,  32, 800,"X3.22-1983" },
@@ -613,6 +622,14 @@ static struct densities {
{ 0x42, 7398,   187909, "LTO-2" },
{ 0x44, 9638,   244805, "LTO-3" }, 
{ 0x46, 12725,  323215, "LTO-4" }, 
+   { 0x47, 6417,   163000, "DAT-72" },
+   /*
+* XXX KDM note that 0x48 is also the density code for DAT-160.
+* For some reason they used overlapping density codes.
+*/
+#if 0
+   { 0x48, 6870,   174500, "DAT-160" },
+#endif
{ 0x48, 5236,   133000, "SDLTapeI(110)" },
{ 0x49, 7598,   193000, "SDLTapeI(160)" },
{ 0x4a, 0,   0, "T1A" },

Modified: head/usr.bin/mt/mt.1
==
--- head/usr.bin/mt/mt.1Tue Mar  3 21:21:43 2015(r279569)
+++ head/usr.bin/mt/mt.1Tue Mar  3 22:49:07 2015(r279570)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd February 12, 2014
+.Dd March 3, 2014
 .Dt MT 1
 .Os
 .Sh NAME
@@ -503,7 +503,8 @@ Value  WidthTracksDensity   
 0x42   12.7  (0.5)  512  7,398  (187,909)   C   LTO-2
 0x44   12.7  (0.5)  704  9,638  (244,805)   C   LTO-3
 0x46   12.7  (0.5)  896  12,725 (323,215)   C   LTO-4
-0x48   12.7  (0.5)  448  5,236  (133,000) PRML  C   SDLTapeI(110) 6,8
+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
@@ -556,6 +557,7 @@ NOTES
 density code is 0x90.
 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.
 .Ed
 .Sh ENVIRONMENT
 .Bl -tag -width ".Ev TAPE"
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r230587 - in head: share/man/man4 sys/dev/xen/blkback sys/dev/xen/netback sys/kern sys/xen/interface/io

2012-01-26 Thread Kenneth D. Merry
Author: ken
Date: Thu Jan 26 16:35:09 2012
New Revision: 230587
URL: http://svn.freebsd.org/changeset/base/230587

Log:
  Xen netback driver rewrite.
  
  share/man/man4/Makefile,
  share/man/man4/xnb.4,
  sys/dev/xen/netback/netback.c,
  sys/dev/xen/netback/netback_unit_tests.c:
  
Rewrote the netback driver for xen to attach properly via newbus
and work properly in both HVM and PVM mode (only HVM is tested).
Works with the in-tree FreeBSD netfront driver or the Windows
netfront driver from SuSE.  Has not been extensively tested with
a Linux netfront driver.  Does not implement LRO, TSO, or
polling.  Includes unit tests that may be run through sysctl
after compiling with XNB_DEBUG defined.
  
  sys/dev/xen/blkback/blkback.c,
  sys/xen/interface/io/netif.h:
  
Comment elaboration.
  
  sys/kern/uipc_mbuf.c:
  
Fix page fault in kernel mode when calling m_print() on a
null mbuf.  Since m_print() is only used for debugging, there
are no performance concerns for extra error checking code.
  
  sys/kern/subr_scanf.c:
  
Add the "hh" and "ll" width specifiers from C99 to scanf().
A few callers were already using "ll" even though scanf()
was handling it as "l".
  
  Submitted by: Alan Somers 
  Submitted by: John Suykerbuyk 
  Sponsored by: Spectra Logic
  MFC after:1 week
  Reviewed by:  ken

Added:
  head/share/man/man4/xnb.4   (contents, props changed)
  head/sys/dev/xen/netback/netback_unit_tests.c   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/sys/dev/xen/blkback/blkback.c
  head/sys/dev/xen/netback/netback.c
  head/sys/kern/subr_scanf.c
  head/sys/kern/uipc_mbuf.c
  head/sys/xen/interface/io/netif.h

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileThu Jan 26 15:23:45 2012
(r230586)
+++ head/share/man/man4/MakefileThu Jan 26 16:35:09 2012
(r230587)
@@ -531,6 +531,7 @@ MAN=aac.4 \
${_xen.4} \
xhci.4 \
xl.4 \
+   ${_xnb.4} \
xpt.4 \
zero.4 \
zyd.4
@@ -731,6 +732,7 @@ _urtw.4=urtw.4
 _viawd.4=  viawd.4
 _wpi.4=wpi.4
 _xen.4=xen.4
+_xnb.4=xnb.4
 
 MLINKS+=lindev.4 full.4
 .endif

Added: head/share/man/man4/xnb.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/xnb.4   Thu Jan 26 16:35:09 2012(r230587)
@@ -0,0 +1,134 @@
+.\" Copyright (c) 2012 Spectra Logic Corporation
+.\"All rights reserved.
+.\"
+.\"
+.\" 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,
+.\"without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\"substantially similar to the "NO WARRANTY" disclaimer below
+.\"("Disclaimer") and any redistribution must be conditioned upon
+.\"including a substantially similar Disclaimer requirement for further
+.\"binary redistribution.
+.\" 
+.\" NO WARRANTY
+.\" 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 MERCHANTIBILITY AND FITNESS FOR
+.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+.\" 
+.\" Authors: Alan Somers (Spectra Logic Corporation)
+.\" 
+.\" $FreeBSD$
+.\"
+
+.Dd January 6, 2012
+.Dt XNB 4
+.Os 
+.Sh NAME
+.Nm xnb
+.Nd "Xen Paravirtualized Backend Ethernet Driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options XENHVM"
+.Cd "device xenpci"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides the back half of a paravirtualized
+.Xr xen 4
+network connection.  The netback and netfront drivers appear to their
+respective operating systems as Ethernet devices linked by a crossover cable.
+Typically,
+.Nm
+will run on Domain 0 and the netfront driver will run on a guest domain.
+However, it is also possible to run
+.Nm
+on a

svn commit: r230589 - head/share/man/man4

2012-01-26 Thread Kenneth D. Merry
Author: ken
Date: Thu Jan 26 17:28:33 2012
New Revision: 230589
URL: http://svn.freebsd.org/changeset/base/230589

Log:
  Start sentences on a new line, and fix a few other nits.
  
  Prompted by:  gjb
  MFC after:1 week

Modified:
  head/share/man/man4/xnb.4

Modified: head/share/man/man4/xnb.4
==
--- head/share/man/man4/xnb.4   Thu Jan 26 17:04:17 2012(r230588)
+++ head/share/man/man4/xnb.4   Thu Jan 26 17:28:33 2012(r230589)
@@ -1,6 +1,5 @@
 .\" Copyright (c) 2012 Spectra Logic Corporation
-.\"All rights reserved.
-.\"
+.\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -30,7 +29,7 @@
 .\" Authors: Alan Somers (Spectra Logic Corporation)
 .\" 
 .\" $FreeBSD$
-.\"
+.\" 
 
 .Dd January 6, 2012
 .Dt XNB 4
@@ -50,24 +49,26 @@ The
 .Nm
 driver provides the back half of a paravirtualized
 .Xr xen 4
-network connection.  The netback and netfront drivers appear to their
-respective operating systems as Ethernet devices linked by a crossover cable.
+network connection.
+The netback and netfront drivers appear to their respective operating
+systems as Ethernet devices linked by a crossover cable.
 Typically,
 .Nm
 will run on Domain 0 and the netfront driver will run on a guest domain.
 However, it is also possible to run
 .Nm
-on a guest domain.  It may be bridged or routed to provide the netfront's
+on a guest domain.
+It may be bridged or routed to provide the netfront's
 domain access to other guest domains or to a physical network.
 .Pp
 In most respects, the
 .Nm
-device appears to the OS as an other Ethernet device.  It can be configured at
-runtime entirely with
-.Xr ifconfig 8
-\&.  In particular, it supports MAC changing, arbitrary MTU sizes, checksum
-offload for IP, UDP, and TCP for both receive and transmit, and TSO.  However,
-see
+device appears to the OS as an other Ethernet device.
+It can be configured at runtime entirely with
+.Xr ifconfig 8 .
+In particular, it supports MAC changing, arbitrary MTU sizes, checksum
+offload for IP, UDP, and TCP for both receive and transmit, and TSO.
+However, see
 .Sx CAVEATS
 before enabling txcsum, rxcsum, or tso.
 .Sh SYSCTL VARIABLES
@@ -76,47 +77,51 @@ The following read-only variables are av
 .Bl -tag -width indent
 .It Va dev.xnb.%d.dump_rings
 Displays information about the ring buffers used to pass requests between the
-netfront and netback.  Mostly useful for debugging, but can also be used to
+netfront and netback.
+Mostly useful for debugging, but can also be used to
 get traffic statistics.
 .It Va dev.xnb.%d.unit_test_results
-Runs a builtin suite of unit tests and displays the results.  Does not affect
-the operation of the driver in any way.  Note that the test suite simulates
-error conditions; this will result in error messages being printed to the
-system system log.
+Runs a builtin suite of unit tests and displays the results.
+Does not affect the operation of the driver in any way.
+Note that the test suite simulates error conditions; this will result in
+error messages being printed to the system system log.
 .Sh CAVEATS
 Packets sent through Xennet pass over shared memory, so the protocol includes
-no form of link-layer checksum or CRC.  Furthermore, Xennet drivers always
-report to their hosts that they support receive and transmit checksum
-offloading.  They "offload" the checksum calculation by simply skipping it.
+no form of link-layer checksum or CRC.
+Furthermore, Xennet drivers always report to their hosts that they support
+receive and transmit checksum offloading.
+They "offload" the checksum calculation by simply skipping it.
 That works fine for packets that are exchanged between two domains on the same
-machine.  However, when a Xennet interface is bridged to a physical interface,
+machine.
+However, when a Xennet interface is bridged to a physical interface,
 a correct checksum must be attached to any packets bound for that physical
-interface.  Currently, FreeBSD lacks any mechanism for an ethernet device to
+interface.
+Currently, FreeBSD lacks any mechanism for an ethernet device to
 inform the OS that newly received packets are valid even though their checksums
-are not.  So if the netfront driver is configured to offload checksum
-calculations, it will pass non-checksumed packets to
-.Nm
-, which must then calculate the checksum in software before passing the packet
+are not.
+So if the netfront driver is configured to offload checksum calculations,
+it will pass non-checksumed packets to
+.Nm ,
+which must then calculate the checksum in software before passing the packet
 to the OS.
 .Pp
 For this reason, it is recommended that if
 .Nm
 is bridged to a physcal interface, then transmit checksum offloading should be
-disabled on the netfront.  The Xennet protocol does not have any mechanism f

svn commit: r230590 - in head: sbin/camcontrol sys/cam sys/cam/scsi sys/sys usr.sbin/mptutil

2012-01-26 Thread Kenneth D. Merry
Author: ken
Date: Thu Jan 26 18:09:28 2012
New Revision: 230590
URL: http://svn.freebsd.org/changeset/base/230590

Log:
  Add CAM infrastructure to allow reporting when a drive's long read capacity
  data changes.
  
  cam_ccb.h:Add a new advanced information type, CDAI_TYPE_RCAPLONG,
for long read capacity data.
  
  cam_xpt_internal.h:
Add a read capacity data pointer and length to struct cam_ed.
  
  cam_xpt.c:Free the read capacity buffer when a device goes away.
While we're here, make sure we don't leak memory for other
malloced fields in struct cam_ed.
  
  scsi_all.c:   Update the scsi_read_capacity_16() to take a uint8_t * and
a length instead of just a pointer to the parameter data
structure.  This will hopefully make this function somewhat
immune to future changes in the parameter data.
  
  scsi_all.h:   Add some extra bit definitions to struct
scsi_read_capacity_data_long, and bump up the structure
size to the full size specified by SBC-3.
  
Change the prototype for scsi_read_capacity_16().
  
  scsi_da.c:Register changes in read capacity data with the transport
layer.  This allows the transport layer to send out an
async notification to interested parties.  Update the
dasetgeom() API.
  
Use scsi_extract_sense_len() instead of
scsi_extract_sense().
  
  scsi_xpt.c:   Add support for the new CDAI_TYPE_RCAPLONG advanced
information type.
  
Make sure we set the physpath pointer to NULL after freeing
it.  This allows blindly freeing it in the struct cam_ed
destructor.
  
  sys/param.h:  Bump __FreeBSD_version from 105 to 106 to make it
easier for third party drivers to determine that the read
capacity data async notification is available.
  
  camcontrol.c,
  mptutil/mpt_cam.c:
Update these for the new scsi_read_capacity_16() argument
structure.
  
  Sponsored by: Spectra Logic

Modified:
  head/sbin/camcontrol/camcontrol.c
  head/sys/cam/cam_ccb.h
  head/sys/cam/cam_xpt.c
  head/sys/cam/cam_xpt_internal.h
  head/sys/cam/scsi/scsi_all.c
  head/sys/cam/scsi/scsi_all.h
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_xpt.c
  head/sys/sys/param.h
  head/usr.sbin/mptutil/mpt_cam.c

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Thu Jan 26 17:28:33 2012
(r230589)
+++ head/sbin/camcontrol/camcontrol.c   Thu Jan 26 18:09:28 2012
(r230590)
@@ -4232,7 +4232,8 @@ scsireadcapacity(struct cam_device *devi
  /*lba*/ 0,
  /*reladdr*/ 0,
  /*pmi*/ 0,
- &rcaplong,
+ /*rcap_buf*/ (uint8_t *)&rcaplong,
+ /*rcap_buf_len*/ sizeof(rcaplong),
  /*sense_len*/ SSD_FULL_SIZE,
  /*timeout*/ timeout ? timeout : 5000);
 

Modified: head/sys/cam/cam_ccb.h
==
--- head/sys/cam/cam_ccb.h  Thu Jan 26 17:28:33 2012(r230589)
+++ head/sys/cam/cam_ccb.h  Thu Jan 26 18:09:28 2012(r230590)
@@ -1118,6 +1118,7 @@ struct ccb_dev_advinfo {
 #defineCDAI_TYPE_SCSI_DEVID1
 #defineCDAI_TYPE_SERIAL_NUM2
 #defineCDAI_TYPE_PHYS_PATH 3
+#defineCDAI_TYPE_RCAPLONG  4
off_t bufsiz;   /* IN: Size of external buffer */
 #defineCAM_SCSI_DEVID_MAXLEN   65536   /* length in buffer is an 
uint16_t */
off_t provsiz;  /* OUT: Size required/used */

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Jan 26 17:28:33 2012(r230589)
+++ head/sys/cam/cam_xpt.c  Thu Jan 26 18:09:28 2012(r230590)
@@ -4588,6 +4588,17 @@ xpt_release_device(struct cam_ed *device
cam_devq_resize(devq, devq->alloc_queue.array_size - 1);
camq_fini(&device->drvq);
cam_ccbq_fini(&device->ccbq);
+   /*
+* Free allocated memory.  free(9) does nothing if the
+* supplied pointer is NULL, so it is safe to call without
+* checking.
+*/
+   free(device->supported_vpds, M_CAMXPT);
+   free(device->device_id, M_CAMXPT);
+   free(device->physpath, M_CAMXPT);
+   free(device->rcap_buf, M_CAMXPT);
+   free(device->serial_num, M_CAMXPT);
+
xpt_release_tar

svn commit: r230592 - in head/sys: conf dev/mps dev/mps/mpi modules/mps

2012-01-26 Thread Kenneth D. Merry
Author: ken
Date: Thu Jan 26 18:17:21 2012
New Revision: 230592
URL: http://svn.freebsd.org/changeset/base/230592

Log:
  Bring in the LSI-supported version of the mps(4) driver.
  
  This involves significant changes to the mps(4) driver, but is not a
  complete rewrite.
  
  Some of the changes in this version of the driver:
   - Integrated RAID (IR) support.
   - Support for WarpDrive controllers.
   - Support for SCSI protection information (EEDP).
   - Support for TLR (Transport Level Retries), needed for tape drives.
   - Improved error recovery code.
   - ioctl interface compatible with LSI utilities.
  
  mps.4:Update the mps(4) driver man page somewhat for the 
driver
changes.  The list of supported hardware still needs to be
updated to reflect the full list of supported cards.
  
  conf/files:   Add the new driver files.
  
  mps/mpi/*:Updated version of the MPI header files, with a BSD style
copyright.
  
  mps/*:See above for a description of the new driver features.
  
  modules/mps/Makefile:
Add the new mps(4) driver files.
  
  Submitted by: Kashyap Desai 
  Reviewed by:  ken
  MFC after:1 week

Added:
  head/sys/dev/mps/mps_config.c   (contents, props changed)
  head/sys/dev/mps/mps_mapping.c   (contents, props changed)
  head/sys/dev/mps/mps_mapping.h   (contents, props changed)
  head/sys/dev/mps/mps_sas.h   (contents, props changed)
  head/sys/dev/mps/mps_sas_lsi.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/mps/mpi/mpi2.h
  head/sys/dev/mps/mpi/mpi2_cnfg.h
  head/sys/dev/mps/mpi/mpi2_hbd.h
  head/sys/dev/mps/mpi/mpi2_history.txt
  head/sys/dev/mps/mpi/mpi2_init.h
  head/sys/dev/mps/mpi/mpi2_ioc.h
  head/sys/dev/mps/mpi/mpi2_ra.h
  head/sys/dev/mps/mpi/mpi2_raid.h
  head/sys/dev/mps/mpi/mpi2_sas.h
  head/sys/dev/mps/mpi/mpi2_targ.h
  head/sys/dev/mps/mpi/mpi2_tool.h
  head/sys/dev/mps/mpi/mpi2_type.h
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_ioctl.h
  head/sys/dev/mps/mps_pci.c
  head/sys/dev/mps/mps_sas.c
  head/sys/dev/mps/mps_table.c
  head/sys/dev/mps/mps_user.c
  head/sys/dev/mps/mpsvar.h
  head/sys/modules/mps/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Jan 26 18:16:16 2012(r230591)
+++ head/sys/conf/files Thu Jan 26 18:17:21 2012(r230592)
@@ -1469,8 +1469,11 @@ dev/mmc/mmcbus_if.m  standard
 dev/mmc/mmcsd.coptional mmcsd
 dev/mn/if_mn.c optional mn pci
 dev/mps/mps.c  optional mps
+dev/mps/mps_config.c   optional mps
+dev/mps/mps_mapping.c  optional mps
 dev/mps/mps_pci.c  optional mps pci
 dev/mps/mps_sas.c  optional mps
+dev/mps/mps_sas_lsi.c  optional mps
 dev/mps/mps_table.coptional mps
 dev/mps/mps_user.c optional mps
 dev/mpt/mpt.c  optional mpt

Modified: head/sys/dev/mps/mpi/mpi2.h
==
--- head/sys/dev/mps/mpi/mpi2.h Thu Jan 26 18:16:16 2012(r230591)
+++ head/sys/dev/mps/mpi/mpi2.h Thu Jan 26 18:17:21 2012(r230592)
@@ -1,6 +1,35 @@
-/* $FreeBSD$ */
+/*-
+ * Copyright (c) 2011 LSI Corp.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ *
+ * LSI MPT-Fusion Host Adapter FreeBSD
+ *
+ * $FreeBSD$
+ */
+
 /*
- *  Copyright (c) 2000-2009 LSI Corporation.
+ *  Copyright (c) 2000-2011 LSI Corporation.
  *
  *
  *   Name:  mpi2.h
@@ -9,7 +38,7 @@
  *  scatter/gather formats.
  *  Creation Date:  June

svn commit: r230593 - head/share/man/man4

2012-01-26 Thread Kenneth D. Merry
Author: ken
Date: Thu Jan 26 18:18:47 2012
New Revision: 230593
URL: http://svn.freebsd.org/changeset/base/230593

Log:
  Remove the blank line between the license and .Dd
  
  Prompted by:  brueffer
  MFC after:1 week

Modified:
  head/share/man/man4/xnb.4

Modified: head/share/man/man4/xnb.4
==
--- head/share/man/man4/xnb.4   Thu Jan 26 18:17:21 2012(r230592)
+++ head/share/man/man4/xnb.4   Thu Jan 26 18:18:47 2012(r230593)
@@ -30,7 +30,6 @@
 .\" 
 .\" $FreeBSD$
 .\" 
-
 .Dd January 6, 2012
 .Dt XNB 4
 .Os 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r230849 - in stable/9/sys/cam: . scsi

2012-01-31 Thread Kenneth D. Merry
Author: ken
Date: Tue Jan 31 23:04:58 2012
New Revision: 230849
URL: http://svn.freebsd.org/changeset/base/230849

Log:
  MFC: 23, 230544
  
  Fix a race condition in CAM peripheral free handling, locking
  in the CAM XPT bus traversal code, and a number of other periph level
  issues.
  
r230544 | ken | 2012-01-25 10:58:47 -0700 (Wed, 25 Jan 2012) | 9 lines
  
Fix a bug introduced in r23.  We were eliminating all LUNs on a target
in response to CAM_DEV_NOT_THERE, instead of just the LUN in question.
  
This will now just eliminate the specified LUN in response to
CAM_DEV_NOT_THERE.
  
Reported by:Richard Todd 
  
r23 | ken | 2012-01-11 17:41:48 -0700 (Wed, 11 Jan 2012) | 72 lines
  
Fix a race condition in CAM peripheral free handling, locking
in the CAM XPT bus traversal code, and a number of other periph level
issues.
  
cam_periph.h,
cam_periph.c:   Modify cam_periph_acquire() to test the 
CAM_PERIPH_INVALID
flag prior to allowing a reference count to be gained
on a peripheral.  Callers of this function will receive
CAM_REQ_CMP_ERR status in the situation of attempting to
reference an invalidated periph.  This guarantees that
a peripheral scheduled for a deferred free will not
be accessed during its wait for destruction.
  
Panic during attempts to drop a reference count on
a peripheral that already has a zero reference count.
  
In cam_periph_list(), use a local sbuf with SBUF_FIXEDLEN
set so that mallocs do not occur while the xpt topology
lock is held, regardless of the allocation policy of the
passed in sbuf.
  
Add a new routine, cam_periph_release_locked_buses(),
that can be called when the caller already holds
the CAM topology lock.
  
Add some extra debugging for duplicate peripheral
allocations in cam_periph_alloc().
  
Treat CAM_DEV_NOT_THERE much the same as a selection
timeout (AC_LOST_DEVICE is emitted), but forgo retries.
  
cam_xpt.c:  Revamp the way the EDT traversal code does locking
and reference counting.  This was broken, since it
assumed that the EDT would not change during
traversal, but that assumption is no longer valid.
  
So, to prevent devices from going away while we
traverse the EDT, make sure we properly lock
everything and hold references on devices that
we are using.
  
The two peripheral driver traversal routines should
be examined.  xptpdperiphtraverse() holds the
topology lock for the entire time it runs.
xptperiphtraverse() is now locked properly, but
only holds the topology lock while it is traversing
the list, and not while the traversal function is
running.
  
The bus locking code in xptbustraverse() should
also be revisited at a later time, since it is
complex and should probably be simplified.
  
scsi_da.c:  Pay attention to the return value from cam_periph_acquire().
  
Return 0 always from daclose() even if the disk is now gone.
  
Add some rudimentary error injection support.
  
scsi_sg.c:  Fix reference counting in the sg(4) driver.
  
The sg driver was calling cam_periph_release() on close,
but never called cam_periph_acquire() (which increments
the reference count) on open.
  
The periph code correctly complained that the sg(4)
driver was trying to decrement the refcount when it
was already 0.
  
Sponsored by:   Spectra Logic

Modified:
  stable/9/sys/cam/cam_periph.c
  stable/9/sys/cam/cam_periph.h
  stable/9/sys/cam/cam_xpt.c
  stable/9/sys/cam/scsi/scsi_da.c
  stable/9/sys/cam/scsi/scsi_sg.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/cam/cam_periph.c
=

svn commit: r230850 - in stable/8/sys/cam: . scsi

2012-01-31 Thread Kenneth D. Merry
Author: ken
Date: Tue Jan 31 23:09:27 2012
New Revision: 230850
URL: http://svn.freebsd.org/changeset/base/230850

Log:
  MFC: 23, 230544
  
  Fix a race condition in CAM peripheral free handling, locking
  in the CAM XPT bus traversal code, and a number of other periph level
  issues.
  
r230544 | ken | 2012-01-25 10:58:47 -0700 (Wed, 25 Jan 2012) | 9 lines
  
Fix a bug introduced in r23.  We were eliminating all LUNs on a target
in response to CAM_DEV_NOT_THERE, instead of just the LUN in question.
  
This will now just eliminate the specified LUN in response to
CAM_DEV_NOT_THERE.
  
Reported by:Richard Todd 
  
r23 | ken | 2012-01-11 17:41:48 -0700 (Wed, 11 Jan 2012) | 72 lines
  
Fix a race condition in CAM peripheral free handling, locking
in the CAM XPT bus traversal code, and a number of other periph level
issues.
  
cam_periph.h,
cam_periph.c:   Modify cam_periph_acquire() to test the 
CAM_PERIPH_INVALID
flag prior to allowing a reference count to be gained
on a peripheral.  Callers of this function will receive
CAM_REQ_CMP_ERR status in the situation of attempting to
reference an invalidated periph.  This guarantees that
a peripheral scheduled for a deferred free will not
be accessed during its wait for destruction.
  
Panic during attempts to drop a reference count on
a peripheral that already has a zero reference count.
  
In cam_periph_list(), use a local sbuf with SBUF_FIXEDLEN
set so that mallocs do not occur while the xpt topology
lock is held, regardless of the allocation policy of the
passed in sbuf.
  
Add a new routine, cam_periph_release_locked_buses(),
that can be called when the caller already holds
the CAM topology lock.
  
Add some extra debugging for duplicate peripheral
allocations in cam_periph_alloc().
  
Treat CAM_DEV_NOT_THERE much the same as a selection
timeout (AC_LOST_DEVICE is emitted), but forgo retries.
  
cam_xpt.c:  Revamp the way the EDT traversal code does locking
and reference counting.  This was broken, since it
assumed that the EDT would not change during
traversal, but that assumption is no longer valid.
  
So, to prevent devices from going away while we
traverse the EDT, make sure we properly lock
everything and hold references on devices that
we are using.
  
The two peripheral driver traversal routines should
be examined.  xptpdperiphtraverse() holds the
topology lock for the entire time it runs.
xptperiphtraverse() is now locked properly, but
only holds the topology lock while it is traversing
the list, and not while the traversal function is
running.
  
The bus locking code in xptbustraverse() should
also be revisited at a later time, since it is
complex and should probably be simplified.
  
scsi_da.c:  Pay attention to the return value from cam_periph_acquire().
  
Return 0 always from daclose() even if the disk is now gone.
  
Add some rudimentary error injection support.
  
scsi_sg.c:  Fix reference counting in the sg(4) driver.
  
The sg driver was calling cam_periph_release() on close,
but never called cam_periph_acquire() (which increments
the reference count) on open.
  
The periph code correctly complained that the sg(4)
driver was trying to decrement the refcount when it
was already 0.
  
Sponsored by:   Spectra Logic

Modified:
  stable/8/sys/cam/cam_periph.c
  stable/8/sys/cam/cam_periph.h
  stable/8/sys/cam/cam_xpt.c
  stable/8/sys/cam/scsi/scsi_da.c
  stable/8/sys/cam/scsi/scsi_sg.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/cam/cam_periph.c
==
--- stable/8/sys/cam/cam_periph.c   Tue Jan 31 23:04:58 2012
(r230849)
+++ stable/8/sys/cam/cam_periph.c   Tue Jan 31 23:09:27 2012
(r230850)
@@ -170,14 +170,16 @@ cam_periph_alloc(periph_ctor_t *periph_c
return (CAM_REQ_INPROG);
} else {
printf("cam_periph_alloc: attempt to re-allocate "
-  "v

svn commit: r230878 - head/sys/conf

2012-02-01 Thread Kenneth D. Merry
Author: ken
Date: Wed Feb  1 20:18:57 2012
New Revision: 230878
URL: http://svn.freebsd.org/changeset/base/230878

Log:
  Add the netback driver to the build.
  
  MFC after:3 days

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Feb  1 20:12:44 2012(r230877)
+++ head/sys/conf/files Wed Feb  1 20:18:57 2012(r230878)
@@ -3532,6 +3532,7 @@ dev/xen/blkback/blkback.c optional xen |
 dev/xen/console/console.c  optional xen
 dev/xen/console/xencons_ring.c optional xen
 dev/xen/control/control.c  optional xen | xenhvm
+dev/xen/netback/netback.c  optional xen | xenhvm
 dev/xen/netfront/netfront.coptional xen | xenhvm
 dev/xen/xenpci/xenpci.coptional xenpci
 dev/xen/xenpci/evtchn.c optional xenpci
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r230879 - head/sys/xen/interface/io

2012-02-01 Thread Kenneth D. Merry
Author: ken
Date: Wed Feb  1 20:19:33 2012
New Revision: 230879
URL: http://svn.freebsd.org/changeset/base/230879

Log:
  Add the GSO prefix descriptor define.
  
  MFC after:3 days

Modified:
  head/sys/xen/interface/io/netif.h

Modified: head/sys/xen/interface/io/netif.h
==
--- head/sys/xen/interface/io/netif.h   Wed Feb  1 20:18:57 2012
(r230878)
+++ head/sys/xen/interface/io/netif.h   Wed Feb  1 20:19:33 2012
(r230879)
@@ -173,6 +173,10 @@ typedef struct netif_rx_request netif_rx
 #define _NETRXF_extra_info (3)
 #define  NETRXF_extra_info (1U<<_NETRXF_extra_info)
 
+/* GSO Prefix descriptor. */
+#define _NETRXF_gso_prefix (4)
+#define  NETRXF_gso_prefix (1U<<_NETRXF_gso_prefix)
+
 struct netif_rx_response {
 uint16_t id;
 uint16_t offset;   /* Offset in page of start of received packet  */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r230902 - head/sys/conf

2012-02-01 Thread Kenneth D. Merry
Author: ken
Date: Thu Feb  2 07:38:40 2012
New Revision: 230902
URL: http://svn.freebsd.org/changeset/base/230902

Log:
  Unbreak the i386 full PV (XEN kernel) build by reverting rev 230878 and
  taking the netback driver out of the build temporarily.

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Feb  2 06:39:33 2012(r230901)
+++ head/sys/conf/files Thu Feb  2 07:38:40 2012(r230902)
@@ -3531,7 +3531,6 @@ dev/xen/blkback/blkback.c optional xen |
 dev/xen/console/console.c  optional xen
 dev/xen/console/xencons_ring.c optional xen
 dev/xen/control/control.c  optional xen | xenhvm
-dev/xen/netback/netback.c  optional xen | xenhvm
 dev/xen/netfront/netfront.coptional xen | xenhvm
 dev/xen/xenpci/xenpci.coptional xenpci
 dev/xen/xenpci/evtchn.c optional xenpci
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r230878 - head/sys/conf

2012-02-01 Thread Kenneth D. Merry
On Thu, Feb 02, 2012 at 03:56:03 +, Bjoern A. Zeeb wrote:
> On 1. Feb 2012, at 20:18 , Kenneth D. Merry wrote:
> 
> > Author: ken
> > Date: Wed Feb  1 20:18:57 2012
> > New Revision: 230878
> > URL: http://svn.freebsd.org/changeset/base/230878
> > 
> > Log:
> >  Add the netback driver to the build.
> 
> I guess only tested on amd64...
> 
> ===> i386 XENHVM failed (_.i386.XENHVM):
> >>> Kernel build for XENHVM started on Thu Feb  2 02:29:12 UTC 2012
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c: In function 
> 'xnb_txpkt2gnttab':
> 
> ===> i386 XEN failed (_.i386.XEN):
> >>> Kernel build for XEN started on Thu Feb  2 02:29:11 UTC 2012
> 
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c: In function 
> 'xnb_free_communication_mem':
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:622: error: 
> 'kernel_map' undeclared (first use in this function)
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:622: error: (Each 
> undeclared identifier is reported only once
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:622: error: for each 
> function it appears in.)
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c: In function 
> 'xnb_alloc_communication_mem':
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:812: error: 
> 'kernel_map' undeclared (first use in this function)

Whoops!  Sorry about that.

I backed it out until I can figure out the right way to fix it.  My build
machine is bogged down with nightly backups at the moment, so figuring out
the fix isn't going to happen tonight.

Thanks,

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


svn commit: r230916 - in head/sys: conf dev/xen/netback i386/include/xen

2012-02-02 Thread Kenneth D. Merry
Author: ken
Date: Thu Feb  2 17:54:35 2012
New Revision: 230916
URL: http://svn.freebsd.org/changeset/base/230916

Log:
  Fix the netback driver build for i386.
  
  netback.c:Add missing VM includes.
  
  xen/xenvar.h,
  xen/xenpmap.h:Move some XENHVM macros from  to
 on i386 to match the amd64 headers.
  
  conf/files:   Add netback to the build.
  
  Submitted by: jhb
  MFC after:3 days

Modified:
  head/sys/conf/files
  head/sys/dev/xen/netback/netback.c
  head/sys/i386/include/xen/xenpmap.h
  head/sys/i386/include/xen/xenvar.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Feb  2 17:25:39 2012(r230915)
+++ head/sys/conf/files Thu Feb  2 17:54:35 2012(r230916)
@@ -3531,6 +3531,7 @@ dev/xen/blkback/blkback.c optional xen |
 dev/xen/console/console.c  optional xen
 dev/xen/console/xencons_ring.c optional xen
 dev/xen/control/control.c  optional xen | xenhvm
+dev/xen/netback/netback.c  optional xen | xenhvm
 dev/xen/netfront/netfront.coptional xen | xenhvm
 dev/xen/xenpci/xenpci.coptional xenpci
 dev/xen/xenpci/evtchn.c optional xenpci

Modified: head/sys/dev/xen/netback/netback.c
==
--- head/sys/dev/xen/netback/netback.c  Thu Feb  2 17:25:39 2012
(r230915)
+++ head/sys/dev/xen/netback/netback.c  Thu Feb  2 17:54:35 2012
(r230916)
@@ -75,6 +75,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 

Modified: head/sys/i386/include/xen/xenpmap.h
==
--- head/sys/i386/include/xen/xenpmap.h Thu Feb  2 17:25:39 2012
(r230915)
+++ head/sys/i386/include/xen/xenpmap.h Thu Feb  2 17:54:35 2012
(r230916)
@@ -232,15 +232,6 @@ phys_to_machine_mapping_valid(unsigned l
return xen_phys_machine[pfn] != INVALID_P2M_ENTRY;
 }
 
-#elif defined(XENHVM)
-
-#defineset_phys_to_machine(pfn, mfn)   ((void)0)
-#definephys_to_machine_mapping_valid(pfn)  (TRUE)
-
-#if !defined(PAE)
-#definevtomach(va) pmap_kextract((vm_offset_t) (va))
-#endif
-
-#endif /* !XEN && !XENHVM */
+#endif /* !XEN */
 
 #endif /* _XEN_XENPMAP_H_ */

Modified: head/sys/i386/include/xen/xenvar.h
==
--- head/sys/i386/include/xen/xenvar.h  Thu Feb  2 17:25:39 2012
(r230915)
+++ head/sys/i386/include/xen/xenvar.h  Thu Feb  2 17:54:35 2012
(r230916)
@@ -106,9 +106,15 @@ void  xen_destroy_contiguous_region(void
 
 #elif defined(XENHVM)
 
+#if !defined(PAE)
+#definevtomach(va) pmap_kextract((vm_offset_t) (va))
+#endif
 #definePFNTOMFN(pa)(pa)
 #defineMFNTOPFN(ma)(ma)
 
+#defineset_phys_to_machine(pfn, mfn)   ((void)0)
+#definephys_to_machine_mapping_valid(pfn)  (TRUE)
+
 #endif /* !XEN && !XENHVM */
 
 #endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r230920 - in stable/9/sys: conf dev/mps dev/mps/mpi modules/mps

2012-02-02 Thread Kenneth D. Merry
Author: ken
Date: Thu Feb  2 19:01:41 2012
New Revision: 230920
URL: http://svn.freebsd.org/changeset/base/230920

Log:
  MFC 230592:
  
  Bring in the LSI-supported version of the mps(4) driver.
  
  This involves significant changes to the mps(4) driver, but is not a
  complete rewrite.
  
  Some of the changes in this version of the driver:
   - Integrated RAID (IR) support.
   - Support for WarpDrive controllers.
   - Support for SCSI protection information (EEDP).
   - Support for TLR (Transport Level Retries), needed for tape drives.
   - Improved error recovery code.
   - ioctl interface compatible with LSI utilities.
  
  mps.4:Update the mps(4) driver man page somewhat for the 
driver
changes.  The list of supported hardware still needs to be
updated to reflect the full list of supported cards.
  
  conf/files:   Add the new driver files.
  
  mps/mpi/*:Updated version of the MPI header files, with a BSD style
copyright.
  
  mps/*:See above for a description of the new driver features.
  
  modules/mps/Makefile:
Add the new mps(4) driver files.
  
  Submitted by: Kashyap Desai 
  Sponsored by: LSI, Spectra Logic
  Reviewed by:  ken

Added:
  stable/9/sys/dev/mps/mps_config.c
 - copied unchanged from r230592, head/sys/dev/mps/mps_config.c
  stable/9/sys/dev/mps/mps_mapping.c
 - copied unchanged from r230592, head/sys/dev/mps/mps_mapping.c
  stable/9/sys/dev/mps/mps_mapping.h
 - copied unchanged from r230592, head/sys/dev/mps/mps_mapping.h
  stable/9/sys/dev/mps/mps_sas.h
 - copied unchanged from r230592, head/sys/dev/mps/mps_sas.h
  stable/9/sys/dev/mps/mps_sas_lsi.c
 - copied unchanged from r230592, head/sys/dev/mps/mps_sas_lsi.c
Modified:
  stable/9/sys/conf/files
  stable/9/sys/dev/mps/mpi/mpi2.h
  stable/9/sys/dev/mps/mpi/mpi2_cnfg.h
  stable/9/sys/dev/mps/mpi/mpi2_hbd.h
  stable/9/sys/dev/mps/mpi/mpi2_history.txt
  stable/9/sys/dev/mps/mpi/mpi2_init.h
  stable/9/sys/dev/mps/mpi/mpi2_ioc.h
  stable/9/sys/dev/mps/mpi/mpi2_ra.h
  stable/9/sys/dev/mps/mpi/mpi2_raid.h
  stable/9/sys/dev/mps/mpi/mpi2_sas.h
  stable/9/sys/dev/mps/mpi/mpi2_targ.h
  stable/9/sys/dev/mps/mpi/mpi2_tool.h
  stable/9/sys/dev/mps/mpi/mpi2_type.h
  stable/9/sys/dev/mps/mps.c
  stable/9/sys/dev/mps/mps_ioctl.h
  stable/9/sys/dev/mps/mps_pci.c
  stable/9/sys/dev/mps/mps_sas.c
  stable/9/sys/dev/mps/mps_table.c
  stable/9/sys/dev/mps/mps_user.c
  stable/9/sys/dev/mps/mpsvar.h
  stable/9/sys/modules/mps/Makefile
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/conf/files
==
--- stable/9/sys/conf/files Thu Feb  2 18:25:12 2012(r230919)
+++ stable/9/sys/conf/files Thu Feb  2 19:01:41 2012(r230920)
@@ -1463,8 +1463,11 @@ dev/mmc/mmcbus_if.m  standard
 dev/mmc/mmcsd.coptional mmcsd
 dev/mn/if_mn.c optional mn pci
 dev/mps/mps.c  optional mps
+dev/mps/mps_config.c   optional mps
+dev/mps/mps_mapping.c  optional mps
 dev/mps/mps_pci.c  optional mps pci
 dev/mps/mps_sas.c  optional mps
+dev/mps/mps_sas_lsi.c  optional mps
 dev/mps/mps_table.coptional mps
 dev/mps/mps_user.c optional mps
 dev/mpt/mpt.c  optional mpt

Modified: stable/9/sys/dev/mps/mpi/mpi2.h
==
--- stable/9/sys/dev/mps/mpi/mpi2.h Thu Feb  2 18:25:12 2012
(r230919)
+++ stable/9/sys/dev/mps/mpi/mpi2.h Thu Feb  2 19:01:41 2012
(r230920)
@@ -1,6 +1,35 @@
-/* $FreeBSD$ */
+/*-
+ * Copyright (c) 2011 LSI Corp.
+ * All rights reserved.
+ *
+ * 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.
+

svn commit: r230922 - in stable/8/sys: conf dev/mps dev/mps/mpi modules/mps

2012-02-02 Thread Kenneth D. Merry
Author: ken
Date: Thu Feb  2 19:03:29 2012
New Revision: 230922
URL: http://svn.freebsd.org/changeset/base/230922

Log:
  MFC 230592:
  
  Bring in the LSI-supported version of the mps(4) driver.
  
  This involves significant changes to the mps(4) driver, but is not a
  complete rewrite.
  
  Some of the changes in this version of the driver:
   - Integrated RAID (IR) support.
   - Support for WarpDrive controllers.
   - Support for SCSI protection information (EEDP).
   - Support for TLR (Transport Level Retries), needed for tape drives.
   - Improved error recovery code.
   - ioctl interface compatible with LSI utilities.
  
  mps.4:Update the mps(4) driver man page somewhat for the 
driver
changes.  The list of supported hardware still needs to be
updated to reflect the full list of supported cards.
  
  conf/files:   Add the new driver files.
  
  mps/mpi/*:Updated version of the MPI header files, with a BSD style
copyright.
  
  mps/*:See above for a description of the new driver features.
  
  modules/mps/Makefile:
Add the new mps(4) driver files.
  
  Submitted by: Kashyap Desai 
  Sponsored by: LSI, Spectra Logic
  Reviewed by:  ken

Added:
  stable/8/sys/dev/mps/mps_config.c
 - copied unchanged from r230592, head/sys/dev/mps/mps_config.c
  stable/8/sys/dev/mps/mps_mapping.c
 - copied unchanged from r230592, head/sys/dev/mps/mps_mapping.c
  stable/8/sys/dev/mps/mps_mapping.h
 - copied unchanged from r230592, head/sys/dev/mps/mps_mapping.h
  stable/8/sys/dev/mps/mps_sas.h
 - copied unchanged from r230592, head/sys/dev/mps/mps_sas.h
  stable/8/sys/dev/mps/mps_sas_lsi.c
 - copied unchanged from r230592, head/sys/dev/mps/mps_sas_lsi.c
Modified:
  stable/8/sys/conf/files
  stable/8/sys/dev/mps/mpi/mpi2.h
  stable/8/sys/dev/mps/mpi/mpi2_cnfg.h
  stable/8/sys/dev/mps/mpi/mpi2_hbd.h
  stable/8/sys/dev/mps/mpi/mpi2_history.txt
  stable/8/sys/dev/mps/mpi/mpi2_init.h
  stable/8/sys/dev/mps/mpi/mpi2_ioc.h
  stable/8/sys/dev/mps/mpi/mpi2_ra.h
  stable/8/sys/dev/mps/mpi/mpi2_raid.h
  stable/8/sys/dev/mps/mpi/mpi2_sas.h
  stable/8/sys/dev/mps/mpi/mpi2_targ.h
  stable/8/sys/dev/mps/mpi/mpi2_tool.h
  stable/8/sys/dev/mps/mpi/mpi2_type.h
  stable/8/sys/dev/mps/mps.c
  stable/8/sys/dev/mps/mps_ioctl.h
  stable/8/sys/dev/mps/mps_pci.c
  stable/8/sys/dev/mps/mps_sas.c
  stable/8/sys/dev/mps/mps_table.c
  stable/8/sys/dev/mps/mps_user.c
  stable/8/sys/dev/mps/mpsvar.h
  stable/8/sys/modules/mps/Makefile
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/conf/files
==
--- stable/8/sys/conf/files Thu Feb  2 19:02:15 2012(r230921)
+++ stable/8/sys/conf/files Thu Feb  2 19:03:29 2012(r230922)
@@ -1345,8 +1345,11 @@ dev/mmc/mmcbus_if.m  standard
 dev/mmc/mmcsd.coptional mmcsd
 dev/mn/if_mn.c optional mn pci
 dev/mps/mps.c  optional mps
+dev/mps/mps_config.c   optional mps
+dev/mps/mps_mapping.c  optional mps
 dev/mps/mps_pci.c  optional mps pci
 dev/mps/mps_sas.c  optional mps
+dev/mps/mps_sas_lsi.c  optional mps
 dev/mps/mps_table.coptional mps
 dev/mps/mps_user.c optional mps
 dev/mpt/mpt.c  optional mpt

Modified: stable/8/sys/dev/mps/mpi/mpi2.h
==
--- stable/8/sys/dev/mps/mpi/mpi2.h Thu Feb  2 19:02:15 2012
(r230921)
+++ stable/8/sys/dev/mps/mpi/mpi2.h Thu Feb  2 19:03:29 2012
(r230922)
@@ -1,6 +1,35 @@
-/* $FreeBSD$ */
+/*-
+ * Copyright (c) 2011 LSI Corp.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PRO

svn commit: r231170 - head/share/man/man4

2012-02-07 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb  7 23:43:29 2012
New Revision: 231170
URL: http://svn.freebsd.org/changeset/base/231170

Log:
  Update the mps(4) man page for the changes in the new LSI-supported driver.
  
  This should have been included in change 230592.
  
  The supported hardware section still needs some updating to reflect
  the current reality.
  
  MFC after:3 days

Modified:
  head/share/man/man4/mps.4

Modified: head/share/man/man4/mps.4
==
--- head/share/man/man4/mps.4   Tue Feb  7 23:24:29 2012(r231169)
+++ head/share/man/man4/mps.4   Tue Feb  7 23:43:29 2012(r231170)
@@ -31,10 +31,10 @@
 .\"
 .\" Author: Ken Merry 
 .\"
-.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#4 $
+.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#6 $
 .\" $FreeBSD$
 .\"
-.Dd September 13, 2010
+.Dd February 7, 2012
 .Dt MPS 4
 .Os
 .Sh NAME
@@ -58,7 +58,7 @@ The
 .Nm
 driver provides support for LSI Logic Fusion-MPT 2
 .Tn SAS
-controllers.
+controllers and WarpDrive solid state storage cards.
 .Sh HARDWARE
 The
 .Nm
@@ -90,6 +90,16 @@ driver instances, set the following tuna
 hw.mps.disable_msi=1
 .Ed
 .Pp
+To disable MSI interrupts for a specific
+.Nm
+driver instance, set the following tunable value in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dev.mps.X.disable_msi=1
+.Ed
+.Pp
+where X is the adapter number.
+.Pp
 To disable MSI-X interrupts for all
 .Nm
 driver instances, set the following tunable value in
@@ -98,19 +108,51 @@ driver instances, set the following tuna
 hw.mps.disable_msix=1
 .Ed
 .Pp
-To allow the driver to send multiple task management commands (like abort,
-LUN reset, etc.), set the following variable:
+To disable MSI-X interrupts for a specific
+.Nm
+driver instance, set the following tunable value in
+.Xr loader.conf 5 :
 .Bd -literal -offset indent
-hw.mps.X.allow_multiple_tm_cmds=1
+dev.mps.X.disable_msix=1
 .Ed
 .Pp
-via
-.Xr loader.conf 5
-or
-.Xr sysctl 8 ,
-where X is the adapter number.
-By default the driver only sends one task management command at a time, to
-avoid causing a potential controller lock-up.
+To set the maximum number of DMA chains allocated for all adapters,
+set the following variable in 
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hw.mps.max_chains=
+.Ed
+.Pp
+To set the maximum number of DMA chains allocated for a specific adapter,
+set the following variable in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dev.mps.X.max_chains=
+.Ed
+.Pp
+This variable may also be viewed via
+.Xr sysctl 8
+to see the maximum set for a given adapter.
+.Pp
+The current number of free chain frames may be seen via the
+dev.mps.X.chain_free
+.Xr sysctl 8
+variable.
+.Pp
+The lowest number of free chain frames may be seen via the
+dev.mps.X.chain_free_lowwater
+.Xr sysctl 8
+variable.
+.Pp
+The current number of active I/O commands is shown in the
+dev.mps.X.io_cmds_active
+.Xr sysctl 8
+variable.
+.Pp
+The maximum number of active I/O command seen since boot is shown in the
+dev.mps.X.io_cmds_highwater
+.Xr sysctl 8
+variable.
 .Sh DEBUGGING
 To enable debugging prints from the
 .Nm
@@ -142,7 +184,9 @@ Enable prints for controller events.
 .Xr pci 4 ,
 .Xr sa 4 ,
 .Xr scsi 4 ,
-.Xr targ 4
+.Xr targ 4 ,
+.Xr loader.conf 5 ,
+.Xr sysctl 8
 .Sh HISTORY
 The
 .Nm
@@ -154,20 +198,19 @@ The
 .Nm
 driver was originally written by
 .An Scott Long Aq sco...@freebsd.org .
+It has been improved and tested by LSI Logic Corporation.
 This man page was written by
 .An Ken Merry Aq k...@freebsd.org .
 .Sh BUGS
-This driver is still in development, it has only been tested on the amd64
-architecture and has some known shortcomings:
+This driver has a couple of known shortcomings:
 .Bl -bullet -compact
 .It
-No IR (Integrated RAID) support.
+Not endian safe.
+It only works on little endian machines (e.g. amd64 and i386).
 .It 
-No userland utility support (e.g.
-.Xr mptutil 8).
-.It
-Sometimes the driver gets into a state where devices arrive and depart multiple
-times, without user intervention.
+No userland utility available (e.g.
+.Xr mptutil 8)
 .It
-The error recovery code isn't complete.
+The driver probes devices sequentially.
+If your system has a large number of devices, the probe will take a while.
 .El
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r231240 - head/sys/dev/mps

2012-02-08 Thread Kenneth D. Merry
Author: ken
Date: Thu Feb  9 00:16:12 2012
New Revision: 231240
URL: http://svn.freebsd.org/changeset/base/231240

Log:
  Bring in a number of mps(4) driver fixes from LSI:
  
  1.  Fixed timeout specification for the msleep in mps_wait_command().
  Added 30 second timeout for mps_wait_command() calls in mps_user.c.
  
  2.  Make sure we call mps_detach_user() from the kldunload path.
  
  3.  Raid Hotplug behavior change.
  
  The driver now removes a volume when it goes to a failed state,
  so we also need to add volume back to the OS when it goes to
  opitimal/degraded/online from failed/missing.
  
  Handle raid volume add and remove from the IR_Volume event.
  4.  Added some more debugging information.
  
  5.  Replace xpt_async(AC_LOST_DEVICE, path, NULL) with
  mpssas_rescan_target().
  
  This is to work around a panic in CAM that shows up when adding a
  drive with a rescan and removing another device from the driver thread
  with an AC_LOST_DEVICE async notification.
  
  This problem was encountered in testing with the LSI sas2ircu utility,
  which was used to create a RAID volume from physical disks.  The driver
  has to create the RAID volume target and remove the physical disk
  targets, and triggered a panic in the process.
  
  The CAM issue needs to be fully diagnosed and fixed, but this works
  around the issue for now.
  
  6.  Fix some memory initialization issues in mps_free_command().
  
  7.  Resolve the "devq freeze forever" issue.  This was caused by the
  internal read capacity command issued in the non-head version of the
  driver.  When the command completed with an error, the driver wasn't
  unfreezing thd device queue.
  
  The version in head uses the CAM infrastructure for getting the read
  capacity information, and therefore doesn't have the same issue.
  
  8.  Bump the version to 13.00.00.00-fbsd. (this is very close to LSI's
  internal stable driver 13.00.00.00)
  
  Submitted by: Kashyap Desai 
  MFC after:3 days

Modified:
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_sas.c
  head/sys/dev/mps/mps_sas.h
  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/mps/mps.c
==
--- head/sys/dev/mps/mps.c  Wed Feb  8 23:57:03 2012(r231239)
+++ head/sys/dev/mps/mps.c  Thu Feb  9 00:16:12 2012(r231240)
@@ -529,7 +529,7 @@ mps_enqueue_request(struct mps_softc *sc
mps_dprint(sc, MPS_TRACE, "%s SMID %u cm %p ccb %p\n", __func__,
cm->cm_desc.Default.SMID, cm, cm->cm_ccb);
 
-   if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE)
+   if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE && !(sc->mps_flags & 
MPS_FLAGS_SHUTDOWN))
mtx_assert(&sc->mps_mtx, MA_OWNED);
 
if (++sc->io_cmds_active > sc->io_cmds_highwater)
@@ -1335,6 +1335,8 @@ mps_free(struct mps_softc *sc)
((error = mps_detach_sas(sc)) != 0))
return (error);
 
+   mps_detach_user(sc);
+
/* Put the IOC back in the READY state. */
mps_lock(sc);
if ((error = mps_transition_ready(sc)) != 0) {
@@ -2142,7 +2144,7 @@ mps_wait_command(struct mps_softc *sc, s
error = mps_map_command(sc, cm);
if ((error != 0) && (error != EINPROGRESS))
return (error);
-   error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout);
+   error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout*hz);
if (error == EWOULDBLOCK)
error = ETIMEDOUT;
return (error);

Modified: head/sys/dev/mps/mps_sas.c
==
--- head/sys/dev/mps/mps_sas.c  Wed Feb  8 23:57:03 2012(r231239)
+++ head/sys/dev/mps/mps_sas.c  Thu Feb  9 00:16:12 2012(r231240)
@@ -139,7 +139,6 @@ static uint8_t op_code_prot[256] = {
 
 MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory");
 
-static struct mpssas_target * mpssas_find_target_by_handle(struct mpssas_softc 
*, int, uint16_t);
 static void mpssas_discovery_timeout(void *data);
 static void mpssas_remove_device(struct mps_softc *, struct mps_command *);
 static void mpssas_remove_complete(struct mps_softc *, struct mps_command *);
@@ -175,7 +174,7 @@ static int mpssas_send_portenable(struct
 static void mpssas_portenable_complete(struct mps_softc *sc,
 struct mps_command *cm);
 
-static struct mpssas_target *
+struct mpssas_target *
 mpssas_find_target_by_handle(struct mpssas_softc *sassc, int start, uint16_t 
handle)
 {
struct mpssas_target *target;
@@ -351,22 +350,123 @@ mpssas_log_command(struct mps_command *c
va_end(ap);
 }
 
+
 static void
-mpssas_lost_target(struct mps_softc *sc, struct mpssas_target *targ)
+mpssas_remove_volume(struct mps_softc *sc, struct mps_command *tm)
 {
-   struct mpssas_softc *sassc = sc->sassc;
- 

svn commit: r231392 - stable/9/share/man/man4

2012-02-10 Thread Kenneth D. Merry
Author: ken
Date: Fri Feb 10 18:14:25 2012
New Revision: 231392
URL: http://svn.freebsd.org/changeset/base/231392

Log:
  MFC 231170
  
  Update the mps(4) man page for the changes in the new LSI-supported driver.
  
  This should have been included in change 230592.
  
  The supported hardware section still needs some updating to reflect
  the current reality.

Modified:
  stable/9/share/man/man4/mps.4
Directory Properties:
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/mps.4
==
--- stable/9/share/man/man4/mps.4   Fri Feb 10 17:49:14 2012
(r231391)
+++ stable/9/share/man/man4/mps.4   Fri Feb 10 18:14:25 2012
(r231392)
@@ -31,10 +31,10 @@
 .\"
 .\" Author: Ken Merry 
 .\"
-.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#4 $
+.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#6 $
 .\" $FreeBSD$
 .\"
-.Dd September 13, 2010
+.Dd February 7, 2012
 .Dt MPS 4
 .Os
 .Sh NAME
@@ -58,7 +58,7 @@ The
 .Nm
 driver provides support for LSI Logic Fusion-MPT 2
 .Tn SAS
-controllers.
+controllers and WarpDrive solid state storage cards.
 .Sh HARDWARE
 The
 .Nm
@@ -90,6 +90,16 @@ driver instances, set the following tuna
 hw.mps.disable_msi=1
 .Ed
 .Pp
+To disable MSI interrupts for a specific
+.Nm
+driver instance, set the following tunable value in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dev.mps.X.disable_msi=1
+.Ed
+.Pp
+where X is the adapter number.
+.Pp
 To disable MSI-X interrupts for all
 .Nm
 driver instances, set the following tunable value in
@@ -98,19 +108,51 @@ driver instances, set the following tuna
 hw.mps.disable_msix=1
 .Ed
 .Pp
-To allow the driver to send multiple task management commands (like abort,
-LUN reset, etc.), set the following variable:
+To disable MSI-X interrupts for a specific
+.Nm
+driver instance, set the following tunable value in
+.Xr loader.conf 5 :
 .Bd -literal -offset indent
-hw.mps.X.allow_multiple_tm_cmds=1
+dev.mps.X.disable_msix=1
 .Ed
 .Pp
-via
-.Xr loader.conf 5
-or
-.Xr sysctl 8 ,
-where X is the adapter number.
-By default the driver only sends one task management command at a time, to
-avoid causing a potential controller lock-up.
+To set the maximum number of DMA chains allocated for all adapters,
+set the following variable in 
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hw.mps.max_chains=
+.Ed
+.Pp
+To set the maximum number of DMA chains allocated for a specific adapter,
+set the following variable in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dev.mps.X.max_chains=
+.Ed
+.Pp
+This variable may also be viewed via
+.Xr sysctl 8
+to see the maximum set for a given adapter.
+.Pp
+The current number of free chain frames may be seen via the
+dev.mps.X.chain_free
+.Xr sysctl 8
+variable.
+.Pp
+The lowest number of free chain frames may be seen via the
+dev.mps.X.chain_free_lowwater
+.Xr sysctl 8
+variable.
+.Pp
+The current number of active I/O commands is shown in the
+dev.mps.X.io_cmds_active
+.Xr sysctl 8
+variable.
+.Pp
+The maximum number of active I/O command seen since boot is shown in the
+dev.mps.X.io_cmds_highwater
+.Xr sysctl 8
+variable.
 .Sh DEBUGGING
 To enable debugging prints from the
 .Nm
@@ -142,7 +184,9 @@ Enable prints for controller events.
 .Xr pci 4 ,
 .Xr sa 4 ,
 .Xr scsi 4 ,
-.Xr targ 4
+.Xr targ 4 ,
+.Xr loader.conf 5 ,
+.Xr sysctl 8
 .Sh HISTORY
 The
 .Nm
@@ -154,20 +198,19 @@ The
 .Nm
 driver was originally written by
 .An Scott Long Aq sco...@freebsd.org .
+It has been improved and tested by LSI Logic Corporation.
 This man page was written by
 .An Ken Merry Aq k...@freebsd.org .
 .Sh BUGS
-This driver is still in development, it has only been tested on the amd64
-architecture and has some known shortcomings:
+This driver has a couple of known shortcomings:
 .Bl -bullet -compact
 .It
-No IR (Integrated RAID) support.
+Not endian safe.
+It only works on little endian machines (e.g. amd64 and i386).
 .It 
-No userland utility support (e.g.
-.Xr mptutil 8).
-.It
-Sometimes the driver gets into a state where devices arrive and depart multiple
-times, without user intervention.
+No userland utility available (e.g.
+.Xr mptutil 8)
 .It
-The error recovery code isn't complete.
+The driver probes devices sequentially.
+If your system has a large number of devices, the probe will take a while.
 .El
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r231393 - stable/8/share/man/man4

2012-02-10 Thread Kenneth D. Merry
Author: ken
Date: Fri Feb 10 18:15:45 2012
New Revision: 231393
URL: http://svn.freebsd.org/changeset/base/231393

Log:
  MFC 231170
  
  Update the mps(4) man page for the changes in the new LSI-supported driver.
  
  This should have been included in change 230592.
  
  The supported hardware section still needs some updating to reflect
  the current reality.

Modified:
  stable/8/share/man/man4/mps.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)

Modified: stable/8/share/man/man4/mps.4
==
--- stable/8/share/man/man4/mps.4   Fri Feb 10 18:14:25 2012
(r231392)
+++ stable/8/share/man/man4/mps.4   Fri Feb 10 18:15:45 2012
(r231393)
@@ -31,10 +31,10 @@
 .\"
 .\" Author: Ken Merry 
 .\"
-.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#4 $
+.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#6 $
 .\" $FreeBSD$
 .\"
-.Dd September 13, 2010
+.Dd February 7, 2012
 .Dt MPS 4
 .Os
 .Sh NAME
@@ -58,7 +58,7 @@ The
 .Nm
 driver provides support for LSI Logic Fusion-MPT 2
 .Tn SAS
-controllers.
+controllers and WarpDrive solid state storage cards.
 .Sh HARDWARE
 The
 .Nm
@@ -90,6 +90,16 @@ driver instances, set the following tuna
 hw.mps.disable_msi=1
 .Ed
 .Pp
+To disable MSI interrupts for a specific
+.Nm
+driver instance, set the following tunable value in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dev.mps.X.disable_msi=1
+.Ed
+.Pp
+where X is the adapter number.
+.Pp
 To disable MSI-X interrupts for all
 .Nm
 driver instances, set the following tunable value in
@@ -98,19 +108,51 @@ driver instances, set the following tuna
 hw.mps.disable_msix=1
 .Ed
 .Pp
-To allow the driver to send multiple task management commands (like abort,
-LUN reset, etc.), set the following variable:
+To disable MSI-X interrupts for a specific
+.Nm
+driver instance, set the following tunable value in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dev.mps.X.disable_msix=1
+.Ed
+.Pp
+To set the maximum number of DMA chains allocated for all adapters,
+set the following variable in 
+.Xr loader.conf 5 :
 .Bd -literal -offset indent
-hw.mps.X.allow_multiple_tm_cmds=1
+hw.mps.max_chains=
 .Ed
 .Pp
-via
-.Xr loader.conf 5
-or
-.Xr sysctl 8 ,
-where X is the adapter number.
-By default the driver only sends one task management command at a time, to
-avoid causing a potential controller lock-up.
+To set the maximum number of DMA chains allocated for a specific adapter,
+set the following variable in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dev.mps.X.max_chains=
+.Ed
+.Pp
+This variable may also be viewed via
+.Xr sysctl 8
+to see the maximum set for a given adapter.
+.Pp
+The current number of free chain frames may be seen via the
+dev.mps.X.chain_free
+.Xr sysctl 8
+variable.
+.Pp
+The lowest number of free chain frames may be seen via the
+dev.mps.X.chain_free_lowwater
+.Xr sysctl 8
+variable.
+.Pp
+The current number of active I/O commands is shown in the
+dev.mps.X.io_cmds_active
+.Xr sysctl 8
+variable.
+.Pp
+The maximum number of active I/O command seen since boot is shown in the
+dev.mps.X.io_cmds_highwater
+.Xr sysctl 8
+variable.
 .Sh DEBUGGING
 To enable debugging prints from the
 .Nm
@@ -142,22 +184,9 @@ Enable prints for controller events.
 .Xr pci 4 ,
 .Xr sa 4 ,
 .Xr scsi 4 ,
-.Xr targ 4
-.Sh BUGS
-This driver is still in development, it has only been tested on the amd64
-architecture and has some known shortcomings:
-.Bl -bullet -compact
-.It
-No IR (Integrated RAID) support.
-.It 
-No userland utility support (e.g.
-.Xr mptutil 8).
-.It
-Sometimes the driver gets into a state where devices arrive and depart multiple
-times, without user intervention.
-.It
-The error recovery code isn't complete.
-.El
+.Xr targ 4 ,
+.Xr loader.conf 5 ,
+.Xr sysctl 8
 .Sh HISTORY
 The
 .Nm
@@ -169,5 +198,19 @@ The
 .Nm
 driver was originally written by
 .An Scott Long Aq sco...@freebsd.org .
+It has been improved and tested by LSI Logic Corporation.
 This man page was written by
 .An Ken Merry Aq k...@freebsd.org .
+.Sh BUGS
+This driver has a couple of known shortcomings:
+.Bl -bullet -compact
+.It
+Not endian safe.
+It only works on little endian machines (e.g. amd64 and i386).
+.It 
+No userland utility available (e.g.
+.Xr mptutil 8)
+.It
+The driver probes devices sequentially.
+If your system has a large number of devices, the probe will take a while.
+.El
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r231485 - head/sys/dev/mps

2012-02-10 Thread Kenneth D. Merry
Author: ken
Date: Sat Feb 11 00:28:30 2012
New Revision: 231485
URL: http://svn.freebsd.org/changeset/base/231485

Log:
  Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR from the mps driver
  probe routine.
  
  This will allow LSI to ship drivers that return BUS_PROBE_VENDOR to
  override the in-tree version of the driver.
  
  MFC after:3 days

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

Modified: head/sys/dev/mps/mps_pci.c
==
--- head/sys/dev/mps/mps_pci.c  Sat Feb 11 00:19:31 2012(r231484)
+++ head/sys/dev/mps/mps_pci.c  Sat Feb 11 00:28:30 2012(r231485)
@@ -172,7 +172,7 @@ mps_pci_probe(device_t dev)
 
if ((id = mps_find_ident(dev)) != NULL) {
device_set_desc(dev, id->desc);
-   return (BUS_PROBE_VENDOR);
+   return (BUS_PROBE_DEFAULT);
}
return (ENXIO);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r231679 - stable/9/sys/dev/mps

2012-02-14 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb 14 14:17:46 2012
New Revision: 231679
URL: http://svn.freebsd.org/changeset/base/231679

Log:
  MFC 231240
  
  Bring in a number of mps(4) driver fixes from LSI:
  
  1.  Fixed timeout specification for the msleep in mps_wait_command().
  Added 30 second timeout for mps_wait_command() calls in mps_user.c.
  
  2.  Make sure we call mps_detach_user() from the kldunload path.
  
  3.  Raid Hotplug behavior change.
  
  The driver now removes a volume when it goes to a failed state,
  so we also need to add volume back to the OS when it goes to
  opitimal/degraded/online from failed/missing.
  
  Handle raid volume add and remove from the IR_Volume event.
  4.  Added some more debugging information.
  
  5.  Replace xpt_async(AC_LOST_DEVICE, path, NULL) with
  mpssas_rescan_target().
  
  This is to work around a panic in CAM that shows up when adding a
  drive with a rescan and removing another device from the driver thread
  with an AC_LOST_DEVICE async notification.
  
  This problem was encountered in testing with the LSI sas2ircu utility,
  which was used to create a RAID volume from physical disks.  The driver
  has to create the RAID volume target and remove the physical disk
  targets, and triggered a panic in the process.
  
  The CAM issue needs to be fully diagnosed and fixed, but this works
  around the issue for now.
  
  6.  Fix some memory initialization issues in mps_free_command().
  
  7.  Resolve the "devq freeze forever" issue.  This was caused by the
  internal read capacity command issued in the non-head version of the
  driver.  When the command completed with an error, the driver wasn't
  unfreezing thd device queue.
  
  The version in head uses the CAM infrastructure for getting the read
  capacity information, and therefore doesn't have the same issue.
  
  8.  Bump the version to 13.00.00.00-fbsd. (this is very close to LSI's
  internal stable driver 13.00.00.00)
  
  Submitted by: Kashyap Desai 

Modified:
  stable/9/sys/dev/mps/mps.c
  stable/9/sys/dev/mps/mps_sas.c
  stable/9/sys/dev/mps/mps_sas.h
  stable/9/sys/dev/mps/mps_sas_lsi.c
  stable/9/sys/dev/mps/mps_user.c
  stable/9/sys/dev/mps/mpsvar.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/mps/mps.c
==
--- stable/9/sys/dev/mps/mps.c  Tue Feb 14 12:50:20 2012(r231678)
+++ stable/9/sys/dev/mps/mps.c  Tue Feb 14 14:17:46 2012(r231679)
@@ -529,7 +529,7 @@ mps_enqueue_request(struct mps_softc *sc
mps_dprint(sc, MPS_TRACE, "%s SMID %u cm %p ccb %p\n", __func__,
cm->cm_desc.Default.SMID, cm, cm->cm_ccb);
 
-   if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE)
+   if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE && !(sc->mps_flags & 
MPS_FLAGS_SHUTDOWN))
mtx_assert(&sc->mps_mtx, MA_OWNED);
 
if (++sc->io_cmds_active > sc->io_cmds_highwater)
@@ -1335,6 +1335,8 @@ mps_free(struct mps_softc *sc)
((error = mps_detach_sas(sc)) != 0))
return (error);
 
+   mps_detach_user(sc);
+
/* Put the IOC back in the READY state. */
mps_lock(sc);
if ((error = mps_transition_ready(sc)) != 0) {
@@ -2142,7 +2144,7 @@ mps_wait_command(struct mps_softc *sc, s
error = mps_map_command(sc, cm);
if ((error != 0) && (error != EINPROGRESS))
return (error);
-   error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout);
+   error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout*hz);
if (error == EWOULDBLOCK)
error = ETIMEDOUT;
return (error);

Modified: stable/9/sys/dev/mps/mps_sas.c
==
--- stable/9/sys/dev/mps/mps_sas.c  Tue Feb 14 12:50:20 2012
(r231678)
+++ stable/9/sys/dev/mps/mps_sas.c  Tue Feb 14 14:17:46 2012
(r231679)
@@ -139,7 +139,6 @@ static uint8_t op_code_prot[256] = {
 
 MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory");
 
-static struct mpssas_target * mpssas_find_target_by_handle(struct mpssas_softc 
*, int, uint16_t);
 static void mpssas_discovery_timeout(void *data);
 static void mpssas_remove_device(struct mps_softc *, struct mps_command *);
 static void mpssas_remove_complete(struct mps_softc *, struct mps_command *);
@@ -175,7 +174,7 @@ static int mpssas_send_portenable(struct
 static void mpssas_portenable_complete(struct mps_softc *sc,
 struct mps_command *cm);
 
-static struct mpssas_target *
+struct mpssas_target *
 mpssas_find_target_by_handle(struct mpssas_softc *sassc, int start, uint16_t 
handle)
 {
struct mpssas_target *target;
@@ -351,22 +350,123 @@ mpssas_log_command(struct mps_command *c
va_end(ap);
 }
 
+
 static void
-mpssas_lost_target(struct mps_softc *sc, struct mpssas_target *targ)
+mpssas_remove_volume(stru

svn commit: r231680 - stable/8/sys/dev/mps

2012-02-14 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb 14 14:18:28 2012
New Revision: 231680
URL: http://svn.freebsd.org/changeset/base/231680

Log:
  MFC 231240
  
  Bring in a number of mps(4) driver fixes from LSI:
  
  1.  Fixed timeout specification for the msleep in mps_wait_command().
  Added 30 second timeout for mps_wait_command() calls in mps_user.c.
  
  2.  Make sure we call mps_detach_user() from the kldunload path.
  
  3.  Raid Hotplug behavior change.
  
  The driver now removes a volume when it goes to a failed state,
  so we also need to add volume back to the OS when it goes to
  opitimal/degraded/online from failed/missing.
  
  Handle raid volume add and remove from the IR_Volume event.
  4.  Added some more debugging information.
  
  5.  Replace xpt_async(AC_LOST_DEVICE, path, NULL) with
  mpssas_rescan_target().
  
  This is to work around a panic in CAM that shows up when adding a
  drive with a rescan and removing another device from the driver thread
  with an AC_LOST_DEVICE async notification.
  
  This problem was encountered in testing with the LSI sas2ircu utility,
  which was used to create a RAID volume from physical disks.  The driver
  has to create the RAID volume target and remove the physical disk
  targets, and triggered a panic in the process.
  
  The CAM issue needs to be fully diagnosed and fixed, but this works
  around the issue for now.
  
  6.  Fix some memory initialization issues in mps_free_command().
  
  7.  Resolve the "devq freeze forever" issue.  This was caused by the
  internal read capacity command issued in the non-head version of the
  driver.  When the command completed with an error, the driver wasn't
  unfreezing thd device queue.
  
  The version in head uses the CAM infrastructure for getting the read
  capacity information, and therefore doesn't have the same issue.
  
  8.  Bump the version to 13.00.00.00-fbsd. (this is very close to LSI's
  internal stable driver 13.00.00.00)
  
  Submitted by: Kashyap Desai 

Modified:
  stable/8/sys/dev/mps/mps.c
  stable/8/sys/dev/mps/mps_sas.c
  stable/8/sys/dev/mps/mps_sas.h
  stable/8/sys/dev/mps/mps_sas_lsi.c
  stable/8/sys/dev/mps/mps_user.c
  stable/8/sys/dev/mps/mpsvar.h
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/dev/mps/mps.c
==
--- stable/8/sys/dev/mps/mps.c  Tue Feb 14 14:17:46 2012(r231679)
+++ stable/8/sys/dev/mps/mps.c  Tue Feb 14 14:18:28 2012(r231680)
@@ -529,7 +529,7 @@ mps_enqueue_request(struct mps_softc *sc
mps_dprint(sc, MPS_TRACE, "%s SMID %u cm %p ccb %p\n", __func__,
cm->cm_desc.Default.SMID, cm, cm->cm_ccb);
 
-   if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE)
+   if (sc->mps_flags & MPS_FLAGS_ATTACH_DONE && !(sc->mps_flags & 
MPS_FLAGS_SHUTDOWN))
mtx_assert(&sc->mps_mtx, MA_OWNED);
 
if (++sc->io_cmds_active > sc->io_cmds_highwater)
@@ -1335,6 +1335,8 @@ mps_free(struct mps_softc *sc)
((error = mps_detach_sas(sc)) != 0))
return (error);
 
+   mps_detach_user(sc);
+
/* Put the IOC back in the READY state. */
mps_lock(sc);
if ((error = mps_transition_ready(sc)) != 0) {
@@ -2142,7 +2144,7 @@ mps_wait_command(struct mps_softc *sc, s
error = mps_map_command(sc, cm);
if ((error != 0) && (error != EINPROGRESS))
return (error);
-   error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout);
+   error = msleep(cm, &sc->mps_mtx, 0, "mpswait", timeout*hz);
if (error == EWOULDBLOCK)
error = ETIMEDOUT;
return (error);

Modified: stable/8/sys/dev/mps/mps_sas.c
==
--- stable/8/sys/dev/mps/mps_sas.c  Tue Feb 14 14:17:46 2012
(r231679)
+++ stable/8/sys/dev/mps/mps_sas.c  Tue Feb 14 14:18:28 2012
(r231680)
@@ -139,7 +139,6 @@ static uint8_t op_code_prot[256] = {
 
 MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory");
 
-static struct mpssas_target * mpssas_find_target_by_handle(struct mpssas_softc 
*, int, uint16_t);
 static void mpssas_discovery_timeout(void *data);
 static void mpssas_remove_device(struct mps_softc *, struct mps_command *);
 static void mpssas_remove_complete(struct mps_softc *, struct mps_command *);
@@ -175,7 +174,7 @@ static int mpssas_send_portenable(struct
 static void mpssas_portenable_complete(struct mps_softc *sc,
 struct mps_command *cm);
 
-static struct mpssas_target *
+struct mpssas_target *
 mpssas_find_target_by_handle(struct mpssas_softc *sassc, int start, uint16_t 
handle)
 {
struct mpssas_target *target;
@@ -351,22 +350,123 @@ mpssas_log_command(struct mps_command *c
va_end(ap);
 }
 
+
 static void
-mpssas_lost_target(struct mps_softc *sc, struct mpssas_target *targ)
+mpssas_remove_volume(stru

svn commit: r231690 - stable/9/sys/dev/mps

2012-02-14 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb 14 16:46:59 2012
New Revision: 231690
URL: http://svn.freebsd.org/changeset/base/231690

Log:
  MFC 231485
  
  Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR from the mps driver
  probe routine.
  
  This will allow LSI to ship drivers that return BUS_PROBE_VENDOR to
  override the in-tree version of the driver.

Modified:
  stable/9/sys/dev/mps/mps_pci.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/mps/mps_pci.c
==
--- stable/9/sys/dev/mps/mps_pci.c  Tue Feb 14 15:58:49 2012
(r231689)
+++ stable/9/sys/dev/mps/mps_pci.c  Tue Feb 14 16:46:59 2012
(r231690)
@@ -172,7 +172,7 @@ mps_pci_probe(device_t dev)
 
if ((id = mps_find_ident(dev)) != NULL) {
device_set_desc(dev, id->desc);
-   return (BUS_PROBE_VENDOR);
+   return (BUS_PROBE_DEFAULT);
}
return (ENXIO);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r231691 - stable/8/sys/dev/mps

2012-02-14 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb 14 16:47:52 2012
New Revision: 231691
URL: http://svn.freebsd.org/changeset/base/231691

Log:
  MFC 231485
  
  Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR from the mps driver
  probe routine.
  
  This will allow LSI to ship drivers that return BUS_PROBE_VENDOR to
  override the in-tree version of the driver.

Modified:
  stable/8/sys/dev/mps/mps_pci.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/dev/mps/mps_pci.c
==
--- stable/8/sys/dev/mps/mps_pci.c  Tue Feb 14 16:46:59 2012
(r231690)
+++ stable/8/sys/dev/mps/mps_pci.c  Tue Feb 14 16:47:52 2012
(r231691)
@@ -172,7 +172,7 @@ mps_pci_probe(device_t dev)
 
if ((id = mps_find_ident(dev)) != NULL) {
device_set_desc(dev, id->desc);
-   return (BUS_PROBE_VENDOR);
+   return (BUS_PROBE_DEFAULT);
}
return (ENXIO);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r231697 - in stable/9: share/man/man4 sys/conf sys/dev/xen/blkback sys/dev/xen/netback sys/i386/include/xen sys/kern sys/xen/interface/io

2012-02-14 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb 14 18:00:37 2012
New Revision: 231697
URL: http://svn.freebsd.org/changeset/base/231697

Log:
  MFC 230587, 230916
  
  Xen netback driver rewrite.
  
r230587 | ken | 2012-01-26 09:35:09 -0700 (Thu, 26 Jan 2012) | 38 lines
  
Xen netback driver rewrite.
  
share/man/man4/Makefile,
share/man/man4/xnb.4,
sys/dev/xen/netback/netback.c,
sys/dev/xen/netback/netback_unit_tests.c:
  
Rewrote the netback driver for xen to attach properly via newbus
and work properly in both HVM and PVM mode (only HVM is tested).
Works with the in-tree FreeBSD netfront driver or the Windows
netfront driver from SuSE.  Has not been extensively tested with
a Linux netfront driver.  Does not implement LRO, TSO, or
polling.  Includes unit tests that may be run through sysctl
after compiling with XNB_DEBUG defined.
  
sys/dev/xen/blkback/blkback.c,
sys/xen/interface/io/netif.h:
  
Comment elaboration.
  
sys/kern/uipc_mbuf.c:
  
Fix page fault in kernel mode when calling m_print() on a
null mbuf.  Since m_print() is only used for debugging, there
are no performance concerns for extra error checking code.
  
sys/kern/subr_scanf.c:
  
Add the "hh" and "ll" width specifiers from C99 to scanf().
A few callers were already using "ll" even though scanf()
was handling it as "l".
  
Submitted by:   Alan Somers 
Submitted by:   John Suykerbuyk 
Sponsored by:   Spectra Logic
Reviewed by:ken
  
r230916 | ken | 2012-02-02 10:54:35 -0700 (Thu, 02 Feb 2012) | 13 lines
  
Fix the netback driver build for i386.
  
netback.c:  Add missing VM includes.
  
xen/xenvar.h,
xen/xenpmap.h:  Move some XENHVM macros from  to
 on i386 to match the amd64 headers.
  
conf/files: Add netback to the build.
  
Submitted by:   jhb

Added:
  stable/9/share/man/man4/xnb.4
 - copied unchanged from r230587, head/share/man/man4/xnb.4
  stable/9/sys/dev/xen/netback/netback_unit_tests.c
 - copied unchanged from r230587, 
head/sys/dev/xen/netback/netback_unit_tests.c
Modified:
  stable/9/share/man/man4/Makefile
  stable/9/sys/conf/files
  stable/9/sys/dev/xen/blkback/blkback.c
  stable/9/sys/dev/xen/netback/netback.c
  stable/9/sys/i386/include/xen/xenpmap.h
  stable/9/sys/i386/include/xen/xenvar.h
  stable/9/sys/kern/subr_scanf.c
  stable/9/sys/kern/uipc_mbuf.c
  stable/9/sys/xen/interface/io/netif.h
Directory Properties:
  stable/9/   (props changed)
  stable/9/share/   (props changed)
  stable/9/share/man/   (props changed)
  stable/9/share/man/man4/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/conf/   (props changed)

Modified: stable/9/share/man/man4/Makefile
==
--- stable/9/share/man/man4/MakefileTue Feb 14 17:35:44 2012
(r231696)
+++ stable/9/share/man/man4/MakefileTue Feb 14 18:00:37 2012
(r231697)
@@ -528,6 +528,7 @@ MAN=aac.4 \
${_xen.4} \
xhci.4 \
xl.4 \
+   ${_xnb.4} \
xpt.4 \
zero.4 \
zyd.4
@@ -722,6 +723,7 @@ _urtw.4=urtw.4
 _viawd.4=  viawd.4
 _wpi.4=wpi.4
 _xen.4=xen.4
+_xnb.4=xnb.4
 
 MLINKS+=lindev.4 full.4
 .endif

Copied: stable/9/share/man/man4/xnb.4 (from r230587, head/share/man/man4/xnb.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/9/share/man/man4/xnb.4   Tue Feb 14 18:00:37 2012
(r231697, copy of r230587, head/share/man/man4/xnb.4)
@@ -0,0 +1,134 @@
+.\" Copyright (c) 2012 Spectra Logic Corporation
+.\"All rights reserved.
+.\"
+.\"
+.\" 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,
+.\"without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\"substantially similar to the "NO WARRANTY" disclaimer below
+.\"("Disclaimer") and any redistribution must be conditioned upon
+.\"including a substantially similar Disclaimer requirement for further
+.\"binary redistribution.
+.\" 
+.\" NO WARRANTY
+.\" 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 MERCHANTIBILITY AND FITNESS FOR
+.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SU

svn commit: r231716 - head/sys/dev/mps

2012-02-14 Thread Kenneth D. Merry
Author: ken
Date: Tue Feb 14 22:27:43 2012
New Revision: 231716
URL: http://svn.freebsd.org/changeset/base/231716

Log:
  Set the max_lun field of the path inquiry CCB to 8.
  
  This allows LUNs greater than 0 to be probed.  It can be increased later if
  need be.
  
  This brings back SVN rev 224973, which was inadvertently removed with the
  import of the LSI driver.
  
  Reported by:  dwhite
  MFC after:3 days

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

Modified: head/sys/dev/mps/mps_sas.c
==
--- head/sys/dev/mps/mps_sas.c  Tue Feb 14 22:06:08 2012(r231715)
+++ head/sys/dev/mps/mps_sas.c  Tue Feb 14 22:27:43 2012(r231716)
@@ -919,7 +919,7 @@ mpssas_action(struct cam_sim *sim, union
cpi->hba_misc = PIM_NOBUSRESET;
cpi->hba_eng_cnt = 0;
cpi->max_target = sassc->sc->facts->MaxTargets - 1;
-   cpi->max_lun = 0;
+   cpi->max_lun = 8;
cpi->initiator_id = 255;
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
strncpy(cpi->hba_vid, "LSILogic", HBA_IDLEN);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r231759 - in stable/8: share/man/man4 sys/amd64/conf sys/conf sys/dev/acpica sys/dev/esp sys/dev/twa sys/dev/xen/balloon sys/dev/xen/blkback sys/dev/xen/blkfront sys/dev/xen/console sys...

2012-02-15 Thread Kenneth D. Merry
Author: ken
Date: Wed Feb 15 14:23:01 2012
New Revision: 231759
URL: http://svn.freebsd.org/changeset/base/231759

Log:
  MFC r215818, r216405, r216437, r216448, r216956, r221827, r222975, r223059,
  r225343, r225704, r225705, r225706, r225707, r225709, r226029, r220647,
  r230183, r230587, r230916, r228526, r230879:
  
  Bring Xen support in stable/8 up to parity with head.  Almost all
  outstanding Xen support differences between head and stable/8 are included,
  except for the just added r231743.
  
r215818 | cperciva | 2010-11-25 08:05:21 -0700 (Thu, 25 Nov 2010) | 5 lines
  
Rename HYPERVISOR_multicall (which performs the multicall hypercall) to
_HYPERVISOR_multicall, and create a new HYPERVISOR_multicall function which
invokes _HYPERVISOR_multicall and checks that the individual hypercalls all
succeeded.
  
r216405 | rwatson | 2010-12-13 05:15:46 -0700 (Mon, 13 Dec 2010) | 7 lines
  
Add options NO_ADAPTIVE_SX to the XENHVM kernel configuration, matching
its similar disabling of adaptive mutexes and rwlocks.  The existing
comment on why this is the case also applies to sx locks.
  
MFC after:  3 days
Discussed with: attilio
  
r216437 | gibbs | 2010-12-14 10:23:49 -0700 (Tue, 14 Dec 2010) | 2 lines
  
Remove spurious printf left over from debugging our XenStore support.
  
r216448 | gibbs | 2010-12-14 13:57:40 -0700 (Tue, 14 Dec 2010) | 4 lines
  
Fix a typo in a comment.
  
Noticed by: Attila Nagy 
  
r216956 | rwatson | 2011-01-04 07:49:54 -0700 (Tue, 04 Jan 2011) | 8 lines
  
Make "options XENHVM" compile for i386, not just amd64 -- a largely
mechanical change.  This opens the door for using PV device drivers
under Xen HVM on i386, as well as more general harmonisation of i386
and amd64 Xen support in FreeBSD.
  
Reviewed by:cperciva
MFC after:  3 weeks
  
r221827 | mav | 2011-05-12 21:40:16 -0600 (Thu, 12 May 2011) | 2 lines
  
Fix msleep() usage in Xen balloon driver to not wake up on every HZ tick.
  
r222975 | gibbs | 2011-06-10 22:59:01 -0600 (Fri, 10 Jun 2011) | 63 lines
  
Monitor and emit events for XenStore changes to XenBus trees
of the devices we manage.  These changes can be due to writes
we make ourselves or due to changes made by the control domain.
The goal of these changes is to insure that all state transitions
can be detected regardless of their source and to allow common
device policies (e.g. "onlined" backend devices) to be centralized
in the XenBus bus code.
  
sys/xen/xenbus/xenbusvar.h:
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbus_if.m:
Add a new method for XenBus drivers "localend_changed".
This method is invoked whenever a write is detected to
a device's XenBus tree.  The default implementation of
this method is a no-op.
  
sys/xen/xenbus/xenbus_if.m:
sys/dev/xen/netfront/netfront.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/blkback/blkback.c:
Change the signature of the "otherend_changed" method.
This notification cannot fail, so it should return void.
  
sys/xen/xenbus/xenbusb_back.c:
Add "online" device handling to the XenBus Back Bus
support code.  An online backend device remains active
after a front-end detaches as a reconnect is expected
to occur in the near future.
  
sys/xen/interface/io/xenbus.h:
Add comment block further explaining the meaning and
driver responsibilities associated with the XenBus
Closed state.
  
sys/xen/xenbus/xenbusb.c:
sys/xen/xenbus/xenbusb.h:
sys/xen/xenbus/xenbusb_back.c:
sys/xen/xenbus/xenbusb_front.c:
sys/xen/xenbus/xenbusb_if.m:
o Register a XenStore watch against the local XenBus tree
  for all devices.
o Cache the string length of the path to our local tree.
o Allow the xenbus front and back drivers to hook/filter both
  local and otherend watch processing.
o Update the device ivar version of "state" when we detect
  a XenStore update of that node.
  
sys/dev/xen/control/control.c:
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbusb.c:
sys/xen/xenbus/xenbusb.h:
sys/xen/xenbus/xenbusvar.h:
sys/xen/xenstore/xenstorevar.h:
Allow clients of the XenStore watch mechanism to attach
a single uintptr_t worth of client data to the watch.
This removes the need to carefully place client watch
data within enclosing objects so that a cast or offsetof
calculation can be used to convert from watch to enclosing
object.
  
Sponsored by:   Spectra Logic Corporation
MFC after:  1 week
  
r223059 | gibbs | 2011-06-13 14:36:29 -0600 (Mon, 13 Jun 2011) | 36 lines
  
Several enhancements to the Xen block back driver.
  
sys/dev/xen/blkback/blkback.c:
o Implement front-end request coalescing.  This gre

svn commit: r231772 - in stable/9: share/examples/scsi_target sys/amd64/conf sys/cam/ctl sys/cam/scsi sys/conf sys/dev/ata sys/dev/ciss sys/i386/conf sys/ia64/conf sys/sparc64/conf usr.bin usr.bin/...

2012-02-15 Thread Kenneth D. Merry
Author: ken
Date: Wed Feb 15 17:28:09 2012
New Revision: 231772
URL: http://svn.freebsd.org/changeset/base/231772

Log:
  MFC r229997, r230033, and r230334
  
  Bring the CAM Target Layer into stable/9.
  
r230334 | ken | 2012-01-19 11:42:03 -0700 (Thu, 19 Jan 2012) | 19 lines
  
Quiet some clang warnings when compiling CTL.
  
ctl_error.c,
ctl_error.h:Take out the ctl_sense_format enumeration, and use
scsi_sense_data_type instead.
  
Remove ctl_get_sense_format() and switch ctl_build_ua()
over to using scsi_sense_data_type.
  
ctl_backend_ramdisk.c,
ctl_backend_block.c:
Use C99 structure initializers instead of GNU initializers.
  
ctl.c:  Switch over to using the SCSI sense format enumeration
instead of the CTL-specific enumeration.
  
Submitted by:   dim (partially)
MFC after:  1 month
  
r230033 | ken | 2012-01-12 15:08:33 -0700 (Thu, 12 Jan 2012) | 5 lines
  
Silence some unnecessary verbosity.
  
Reported by:mav
MFC after:  1 month
  
r229997 | ken | 2012-01-11 17:34:33 -0700 (Wed, 11 Jan 2012) | 170 lines
  
Add the CAM Target Layer (CTL).
  
CTL is a disk and processor device emulation subsystem originally written
for Copan Systems under Linux starting in 2003.  It has been shipping in
Copan (now SGI) products since 2005.
  
It was ported to FreeBSD in 2008, and thanks to an agreement between SGI
(who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is
available under a BSD-style license.  The intent behind the agreement was
that Spectra would work to get CTL into the FreeBSD tree.
  
Some CTL features:
  
 - Disk and processor device emulation.
 - Tagged queueing
 - SCSI task attribute support (ordered, head of queue, simple tags)
 - SCSI implicit command ordering support.  (e.g. if a read follows a mode
   select, the read will be blocked until the mode select completes.)
 - Full task management support (abort, LUN reset, target reset, etc.)
 - Support for multiple ports
 - Support for multiple simultaneous initiators
 - Support for multiple simultaneous backing stores
 - Persistent reservation support
 - Mode sense/select support
 - Error injection support
 - High Availability support (1)
 - All I/O handled in-kernel, no userland context switch overhead.
  
(1) HA Support is just an API stub, and needs much more to be fully
functional.
  
ctl.c:  The core of CTL.  Command handlers and 
processing,
character driver, and HA support are here.
  
ctl.h:  Basic function declarations and data structures.
  
ctl_backend.c,
ctl_backend.h:  The basic CTL backend API.
  
ctl_backend_block.c,
ctl_backend_block.h:The block and file backend.  This allows for 
using
a disk or a file as the backing store for a LUN.
Multiple threads are started to do I/O to the
backing device, primarily because the VFS API
requires that to get any concurrency.
  
ctl_backend_ramdisk.c:  A "fake" ramdisk backend.  It only allocates a
small amount of memory to act as a source and sink
for reads and writes from an initiator.  Therefore
it cannot be used for any real data, but it can be
used to test for throughput.  It can also be used
to test initiators' support for extremely large LUNs.
  
ctl_cmd_table.c:This is a table with all 256 possible SCSI opcodes,
and command handler functions defined for supported
opcodes.
  
ctl_debug.h:Debugging support.
  
ctl_error.c,
ctl_error.h:CTL-specific wrappers around the CAM sense 
building
functions.
  
ctl_frontend.c,
ctl_frontend.h: These files define the basic CTL frontend port 
API.
  
ctl_frontend_cam_sim.c: This is a CTL frontend port that is also a CAM 
SIM.
This frontend allows for using CTL without any
target-capable hardware.  So any LUNs you create in
CTL are visible in CAM via this port.
  
ctl_frontend_internal.c,
ctl_frontend_internal.h:
This is a frontend port written for Copan to do
some system-specific tasks that required sending
commands into CTL from inside the kernel.  This
isn't entirely relevant to FreeBSD in general,
but can perhaps be repurposed.
  
ctl_ha.h:   This is a stubbed-out High Availability AP

svn commit: r231773 - stable/9/sys/cam/ctl

2012-02-15 Thread Kenneth D. Merry
Author: ken
Date: Wed Feb 15 17:46:16 2012
New Revision: 231773
URL: http://svn.freebsd.org/changeset/base/231773

Log:
  MFC r231092
  
r231092 | emaste | 2012-02-06 11:11:00 -0700 (Mon, 06 Feb 2012) | 4 lines
  
Avoid panic from unlocking a not locked mutex (in some error cases).
  
Reviewed by:ken@

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

Modified: stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c
==
--- stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c Wed Feb 15 17:28:09 2012
(r231772)
+++ stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c Wed Feb 15 17:46:16 2012
(r231773)
@@ -221,6 +221,7 @@ cfcs_init(void)
 
mtx_lock(&softc->lock);
if (xpt_bus_register(softc->sim, NULL, 0) != CAM_SUCCESS) {
+   mtx_unlock(&softc->lock);
printf("%s: error registering SIM\n", __func__);
retval = ENOMEM;
goto bailout;
@@ -230,6 +231,7 @@ cfcs_init(void)
cam_sim_path(softc->sim),
CAM_TARGET_WILDCARD,
CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+   mtx_unlock(&softc->lock);
printf("%s: error creating path\n", __func__);
xpt_bus_deregister(cam_sim_path(softc->sim));
retval = 1;
@@ -253,8 +255,6 @@ bailout:
else if (softc->devq)
cam_simq_free(softc->devq);
 
-   mtx_unlock(&softc->lock);
-
return (retval);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r231814 - in head/sys: kern sys

2012-02-16 Thread Kenneth D. Merry
On Thu, Feb 16, 2012 at 11:13:09 +0200, Andriy Gapon wrote:
> on 16/02/2012 11:00 Andriy Gapon said the following:
> > on 16/02/2012 10:53 Julian Elischer said the following:
> >> Bruce, this is a good example of a legitimate gripe going un-noticed 
> >> because
> >> you didn't shout loud enough at the right time, at the right people.
> >> It's been about 20 years since we started working on this but I've finally
> >> come to the point of saying that we need you to do more when you see 
> >> problems.
> >> object officially if you think things should be backed out!
> >>
> >> your reasons here seem sound, so it's hard to see why you haven't been more
> >> public about it.
> > 
> > Just for the record: Bruce and I voiced opinions against the commit when it 
> > went
> > in after a rather short notice for such an important thing.  The opinions
> > can be found in the archives of these lists.
> 
> To be more precise: s/opinions against/concerns about behavior in the edge 
> cases/.
> 
> For me personally the immediate benefits in the common situations outweighed 
> the
> problems in the edge cases, although I still believe that we can get the 
> former
> without sacrifices in the latter.

I will happily back the message buffer locking changes out if you and Bruce
agree that that is the best thing to do.

I can also review any proposed fixes to the message buffer locking code,
but I really don't have the bandwidth right now to come up with the "real"
solution.

Sorry I didn't get around to dealing with it, I should have said something
months ago.

Now that you know a fix won't be coming from me, you two can let me know
whether you'd like the changes backed out, or you are certainly free to
commit a solution yourselves.

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


Re: svn commit: r231814 - in head/sys: kern sys

2012-02-16 Thread Kenneth D. Merry
On Fri, Feb 17, 2012 at 06:25:42 +1100, Bruce Evans wrote:
> On Thu, 16 Feb 2012, Kenneth D. Merry wrote:
> 
> >On Thu, Feb 16, 2012 at 11:13:09 +0200, Andriy Gapon wrote:
> >>on 16/02/2012 11:00 Andriy Gapon said the following:
> >>>on 16/02/2012 10:53 Julian Elischer said the following:
> >>>>Bruce, this is a good example of a legitimate gripe going un-noticed 
> >>>>because
> >>>>you didn't shout loud enough at the right time, at the right people.
> >>>>It's been about 20 years since we started working on this but I've 
> >>>>finally
> >>>>come to the point of saying that we need you to do more when you see 
> >>>>problems.
> >>>>object officially if you think things should be backed out!
> >>>>
> >>>>your reasons here seem sound, so it's hard to see why you haven't been 
> >>>>more
> >>>>public about it.
> >>>
> >>>Just for the record: Bruce and I voiced opinions against the commit when 
> >>>it went
> >>>in after a rather short notice for such an important thing.  The opinions
> >>>can be found in the archives of these lists.
> >>
> >>To be more precise: s/opinions against/concerns about behavior in the 
> >>edge cases/.
> >>
> >>For me personally the immediate benefits in the common situations 
> >>outweighed the
> >>problems in the edge cases, although I still believe that we can get the 
> >>former
> >>without sacrifices in the latter.
> >
> >I will happily back the message buffer locking changes out if you and Bruce
> >agree that that is the best thing to do.
> 
> Thanks.  I'm not sure what backing it out would take us back to.

In theory, what I'm suggesting is backing out r222537, r222550, and
probably r231814 (which is the one that started this most recent thread),
since I think it depends on the previous two changes.  It looks like
r226435 (done by marcel) would also need to be removed since I think it was
to fix bugs introduced in my changes.

So I think we need some comment from Eitan on r231814, since that would
probably need to come out as well.  If he is okay with backing out r231814,
and avg agrees as well, then I will back out all four changes.

> >I can also review any proposed fixes to the message buffer locking code,
> >but I really don't have the bandwidth right now to come up with the "real"
> >solution.
> >
> >Sorry I didn't get around to dealing with it, I should have said something
> >months ago.
> >
> >Now that you know a fix won't be coming from me, you two can let me know
> >whether you'd like the changes backed out, or you are certainly free to
> >commit a solution yourselves.
> 
> I seem to remember that I asked you to test my old simple changes for
> printf serialization on your larger systems that apparently generates
> lots of contending printfs.

Yes.  I never got around to that, unfortunately.

> Kernel printfs should be a very rare operation, and kernel syslog messages
> not much more so, so concurrent printfs should be rare-squared.  They
> are a non-problem for me, so my old changes haven't been tested much.
> But I needed serialization the other day for my printfs in trap() to
> debug a deadlock in ddb, since the deadlock is related to to trap()
> racing itself.  I actually used PRINTF_BUFR_SIZE in a ~2008 kernel for
> this.  This is actually a good test of printf() under heavy load.  Any
> line buffering for printf() would have either broken the output format
> (I wanted to show many checkpoint passes per line) or changed the timing
> enough to make the race go away.
> 
> My changes do the following to serialize per printf (not per line):
> - try to acquire a nonstandard spinlock implemented using atomic_cmpset.
> - spin for up to ~1 second (or more like 1 ms if you want) waiting for it
> - ignore the lock after the timeout and proceeed (with complications to
>   not let multiple CPUs proceed at the same time, I hope)
> - when multiple CPUs proceed, use atomic atomic ops as before to avoid
>   races in msgbuf accesses, and depend on console drivers being correct
>   to avoid deadlocks and races in them.  Most aren't correct.
> The worst that is supposed to happen is for deadlock on the nonstandard
> spinlock to occur except for the timeout; then the timeout reduces to
> interleaved output with bugs limited to console drivers by correct
> msgbuf code.  The deadlock on the nonstanded spinlock occurs in buggy
> trap handlers for traps in code holding the lock (mainly ddb traps).
> Then it mainly gives the amusing behaviour that the buggy code is
> punished by printing its output very slowly.

It sounds fine, but I don't have sufficient time to spend on this right
now.  So I can either back out the changes I mentioned above (assuming we
get agreement from avg), or leave things as is.

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


svn commit: r231940 - stable/9/sys/dev/mps

2012-02-20 Thread Kenneth D. Merry
Author: ken
Date: Mon Feb 20 16:50:16 2012
New Revision: 231940
URL: http://svn.freebsd.org/changeset/base/231940

Log:
  MFC r231716
  
Set the max_lun field of the path inquiry CCB to 8.
  
This allows LUNs greater than 0 to be probed.  It can be increased later if
need be.
  
This brings back SVN rev 224973, which was inadvertently removed with the
import of the LSI driver.
  
Reported by:dwhite

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

Modified: stable/9/sys/dev/mps/mps_sas.c
==
--- stable/9/sys/dev/mps/mps_sas.c  Mon Feb 20 15:05:21 2012
(r231939)
+++ stable/9/sys/dev/mps/mps_sas.c  Mon Feb 20 16:50:16 2012
(r231940)
@@ -919,7 +919,7 @@ mpssas_action(struct cam_sim *sim, union
cpi->hba_misc = PIM_NOBUSRESET;
cpi->hba_eng_cnt = 0;
cpi->max_target = sassc->sc->facts->MaxTargets - 1;
-   cpi->max_lun = 0;
+   cpi->max_lun = 8;
cpi->initiator_id = 255;
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
strncpy(cpi->hba_vid, "LSILogic", HBA_IDLEN);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r231944 - stable/8/sys/dev/mps

2012-02-20 Thread Kenneth D. Merry
Author: ken
Date: Mon Feb 20 20:31:05 2012
New Revision: 231944
URL: http://svn.freebsd.org/changeset/base/231944

Log:
  MFC r231716
  
Set the max_lun field of the path inquiry CCB to 8.
  
This allows LUNs greater than 0 to be probed.  It can be increased later if
need be.
  
This brings back SVN rev 224973, which was inadvertently removed with the
import of the LSI driver.
  
Reported by:dwhite
  
  Approved by:  re (bz)

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

Modified: stable/8/sys/dev/mps/mps_sas.c
==
--- stable/8/sys/dev/mps/mps_sas.c  Mon Feb 20 19:35:54 2012
(r231943)
+++ stable/8/sys/dev/mps/mps_sas.c  Mon Feb 20 20:31:05 2012
(r231944)
@@ -919,7 +919,7 @@ mpssas_action(struct cam_sim *sim, union
cpi->hba_misc = PIM_NOBUSRESET;
cpi->hba_eng_cnt = 0;
cpi->max_target = sassc->sc->facts->MaxTargets - 1;
-   cpi->max_lun = 0;
+   cpi->max_lun = 8;
cpi->initiator_id = 255;
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
strncpy(cpi->hba_vid, "LSILogic", HBA_IDLEN);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r232411 - head/sys/dev/mpt

2012-03-02 Thread Kenneth D. Merry
Author: ken
Date: Fri Mar  2 22:00:40 2012
New Revision: 232411
URL: http://svn.freebsd.org/changeset/base/232411

Log:
  Fix a problem that was causing the mpt(4) driver to attach to MegaRAID
  cards that should be handled by the mfi(4) driver.
  
  The root of the problem is that the mpt(4) driver was masking off the
  bottom bit of the PCI device ID when deciding which cards to attach to.
  
  It appears that a number of the mpt(4) Fibre Channel cards had a LAN
  variant whose PCI device ID was just one bit off from the FC card's device
  ID.  The FC cards were even and the LAN cards were odd.
  
  The problem was that this pattern wasn't carried over on the SAS and
  parallel SCSI mpt(4) cards.  Luckily the SAS and parallel SCSI PCI device
  IDs were either even numbers, or they would get masked to a supported
  adjacent PCI device ID, and everything worked well.
  
  Now LSI is using some of the odd-numbered PCI device IDs between the 3Gb
  SAS device IDs for their new MegaRAID cards.  This is causing the mpt(4)
  driver to attach to the RAID cards instead of the mfi(4) driver.
  
  The solution is to stop masking off the bottom bit of the device ID, and
  explicitly list the PCI device IDs of all supported cards.
  
  This change should be a no-op for mpt(4) hardware.  The only intended
  functional change is that for the 929X, the is_fc variable gets set.  It
  wasn't being set previously, but needs to be because the 929X is a Fibre
  Channel card.
  
  Reported by:  Kashyap Desai 
  MFC After:3 days

Modified:
  head/sys/dev/mpt/mpt_pci.c

Modified: head/sys/dev/mpt/mpt_pci.c
==
--- head/sys/dev/mpt/mpt_pci.c  Fri Mar  2 21:46:31 2012(r232410)
+++ head/sys/dev/mpt/mpt_pci.c  Fri Mar  2 22:00:40 2012(r232411)
@@ -129,18 +129,34 @@ __FBSDID("$FreeBSD$");
 #definePCI_PRODUCT_LSI_FC919   0x0624
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC919_LAN
+#definePCI_PRODUCT_LSI_FC919_LAN   0x0625
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC929
 #definePCI_PRODUCT_LSI_FC929   0x0622
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC929_LAN
+#definePCI_PRODUCT_LSI_FC929_LAN   0x0623
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC929X
 #definePCI_PRODUCT_LSI_FC929X  0x0626
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC929X_LAN
+#definePCI_PRODUCT_LSI_FC929X_LAN  0x0627
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC919X
 #definePCI_PRODUCT_LSI_FC919X  0x0628
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC919X_LAN
+#definePCI_PRODUCT_LSI_FC919X_LAN  0x0629
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC7X04X
 #definePCI_PRODUCT_LSI_FC7X04X 0x0640
 #endif
@@ -153,6 +169,10 @@ __FBSDID("$FreeBSD$");
 #definePCI_PRODUCT_LSI_10300x0030
 #endif
 
+#ifndefPCI_PRODUCT_LSI_1030ZC
+#definePCI_PRODUCT_LSI_1030ZC  0x0031
+#endif
+
 #ifndefPCI_PRODUCT_LSI_SAS1064
 #define PCI_PRODUCT_LSI_SAS10640x0050
 #endif
@@ -177,6 +197,10 @@ __FBSDID("$FreeBSD$");
 #define PCI_PRODUCT_LSI_SAS10680x0054
 #endif
 
+#ifndef PCI_PRODUCT_LSI_SAS1068A
+#define PCI_PRODUCT_LSI_SAS1068A   0x0055
+#endif
+
 #ifndef PCI_PRODUCT_LSI_SAS1068E
 #define PCI_PRODUCT_LSI_SAS1068E   0x0058
 #endif
@@ -232,7 +256,7 @@ mpt_pci_probe(device_t dev)
return (ENXIO);
}
 
-   switch ((pci_get_device(dev) & ~1)) {
+   switch (pci_get_device(dev)) {
case PCI_PRODUCT_LSI_FC909:
desc = "LSILogic FC909 FC Adapter";
break;
@@ -242,15 +266,27 @@ mpt_pci_probe(device_t dev)
case PCI_PRODUCT_LSI_FC919:
desc = "LSILogic FC919 FC Adapter";
break;
+   case PCI_PRODUCT_LSI_FC919_LAN:
+   desc = "LSILogic FC919 LAN Adapter";
+   break;
case PCI_PRODUCT_LSI_FC929:
desc = "Dual LSILogic FC929 FC Adapter";
break;
+   case PCI_PRODUCT_LSI_FC929_LAN:
+   desc = "Dual LSILogic FC929 LAN Adapter";
+   break;
case PCI_PRODUCT_LSI_FC919X:
desc = "LSILogic FC919 FC PCI-X Adapter";
break;
+   case PCI_PRODUCT_LSI_FC919X_LAN:
+   desc = "LSILogic FC919 LAN PCI-X Adapter";
+   break;
case PCI_PRODUCT_LSI_FC929X:
desc = "Dual LSILogic FC929X 2Gb/s FC PCI-X Adapter";
break;
+   case PCI_PRODUCT_LSI_FC929X_LAN:
+   desc = "Dual LSILogic FC929X LAN PCI-X Adapter";
+   break;
case PCI_PRODUCT_LSI_FC646:
desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-Express Adapter";
break;
@@ -258,6 +294,7 @@ mpt_pci_probe(device_t dev)
desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-X Adapter";
break;
case PCI_P

svn commit: r232562 - stable/9/sys/dev/mpt

2012-03-05 Thread Kenneth D. Merry
Author: ken
Date: Mon Mar  5 18:54:28 2012
New Revision: 232562
URL: http://svn.freebsd.org/changeset/base/232562

Log:
  MFC 232411:
  
Fix a problem that was causing the mpt(4) driver to attach to MegaRAID
cards that should be handled by the mfi(4) driver.
  
The root of the problem is that the mpt(4) driver was masking off the
bottom bit of the PCI device ID when deciding which cards to attach to.
  
It appears that a number of the mpt(4) Fibre Channel cards had a LAN
variant whose PCI device ID was just one bit off from the FC card's device
ID.  The FC cards were even and the LAN cards were odd.
  
The problem was that this pattern wasn't carried over on the SAS and
parallel SCSI mpt(4) cards.  Luckily the SAS and parallel SCSI PCI device
IDs were either even numbers, or they would get masked to a supported
adjacent PCI device ID, and everything worked well.
  
Now LSI is using some of the odd-numbered PCI device IDs between the 3Gb
SAS device IDs for their new MegaRAID cards.  This is causing the mpt(4)
driver to attach to the RAID cards instead of the mfi(4) driver.
  
The solution is to stop masking off the bottom bit of the device ID, and
explicitly list the PCI device IDs of all supported cards.
  
This change should be a no-op for mpt(4) hardware.  The only intended
functional change is that for the 929X, the is_fc variable gets set.  It
wasn't being set previously, but needs to be because the 929X is a Fibre
Channel card.
  
Reported by:Kashyap Desai 

Modified:
  stable/9/sys/dev/mpt/mpt_pci.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/mpt/mpt_pci.c
==
--- stable/9/sys/dev/mpt/mpt_pci.c  Mon Mar  5 18:47:42 2012
(r232561)
+++ stable/9/sys/dev/mpt/mpt_pci.c  Mon Mar  5 18:54:28 2012
(r232562)
@@ -129,18 +129,34 @@ __FBSDID("$FreeBSD$");
 #definePCI_PRODUCT_LSI_FC919   0x0624
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC919_LAN
+#definePCI_PRODUCT_LSI_FC919_LAN   0x0625
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC929
 #definePCI_PRODUCT_LSI_FC929   0x0622
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC929_LAN
+#definePCI_PRODUCT_LSI_FC929_LAN   0x0623
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC929X
 #definePCI_PRODUCT_LSI_FC929X  0x0626
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC929X_LAN
+#definePCI_PRODUCT_LSI_FC929X_LAN  0x0627
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC919X
 #definePCI_PRODUCT_LSI_FC919X  0x0628
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC919X_LAN
+#definePCI_PRODUCT_LSI_FC919X_LAN  0x0629
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC7X04X
 #definePCI_PRODUCT_LSI_FC7X04X 0x0640
 #endif
@@ -153,6 +169,10 @@ __FBSDID("$FreeBSD$");
 #definePCI_PRODUCT_LSI_10300x0030
 #endif
 
+#ifndefPCI_PRODUCT_LSI_1030ZC
+#definePCI_PRODUCT_LSI_1030ZC  0x0031
+#endif
+
 #ifndefPCI_PRODUCT_LSI_SAS1064
 #define PCI_PRODUCT_LSI_SAS10640x0050
 #endif
@@ -177,6 +197,10 @@ __FBSDID("$FreeBSD$");
 #define PCI_PRODUCT_LSI_SAS10680x0054
 #endif
 
+#ifndef PCI_PRODUCT_LSI_SAS1068A
+#define PCI_PRODUCT_LSI_SAS1068A   0x0055
+#endif
+
 #ifndef PCI_PRODUCT_LSI_SAS1068E
 #define PCI_PRODUCT_LSI_SAS1068E   0x0058
 #endif
@@ -232,7 +256,7 @@ mpt_pci_probe(device_t dev)
return (ENXIO);
}
 
-   switch ((pci_get_device(dev) & ~1)) {
+   switch (pci_get_device(dev)) {
case PCI_PRODUCT_LSI_FC909:
desc = "LSILogic FC909 FC Adapter";
break;
@@ -242,15 +266,27 @@ mpt_pci_probe(device_t dev)
case PCI_PRODUCT_LSI_FC919:
desc = "LSILogic FC919 FC Adapter";
break;
+   case PCI_PRODUCT_LSI_FC919_LAN:
+   desc = "LSILogic FC919 LAN Adapter";
+   break;
case PCI_PRODUCT_LSI_FC929:
desc = "Dual LSILogic FC929 FC Adapter";
break;
+   case PCI_PRODUCT_LSI_FC929_LAN:
+   desc = "Dual LSILogic FC929 LAN Adapter";
+   break;
case PCI_PRODUCT_LSI_FC919X:
desc = "LSILogic FC919 FC PCI-X Adapter";
break;
+   case PCI_PRODUCT_LSI_FC919X_LAN:
+   desc = "LSILogic FC919 LAN PCI-X Adapter";
+   break;
case PCI_PRODUCT_LSI_FC929X:
desc = "Dual LSILogic FC929X 2Gb/s FC PCI-X Adapter";
break;
+   case PCI_PRODUCT_LSI_FC929X_LAN:
+   desc = "Dual LSILogic FC929X LAN PCI-X Adapter";
+   break;
case PCI_PRODUCT_LSI_FC646:
desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-Express Adapter";
break;
@@ -258,6 +294,7 @@ mpt_pci_probe(de

svn commit: r232563 - stable/8/sys/dev/mpt

2012-03-05 Thread Kenneth D. Merry
Author: ken
Date: Mon Mar  5 19:01:23 2012
New Revision: 232563
URL: http://svn.freebsd.org/changeset/base/232563

Log:
  MFC 232411:
  
Fix a problem that was causing the mpt(4) driver to attach to MegaRAID
cards that should be handled by the mfi(4) driver.
  
The root of the problem is that the mpt(4) driver was masking off the
bottom bit of the PCI device ID when deciding which cards to attach to.
  
It appears that a number of the mpt(4) Fibre Channel cards had a LAN
variant whose PCI device ID was just one bit off from the FC card's device
ID.  The FC cards were even and the LAN cards were odd.
  
The problem was that this pattern wasn't carried over on the SAS and
parallel SCSI mpt(4) cards.  Luckily the SAS and parallel SCSI PCI device
IDs were either even numbers, or they would get masked to a supported
adjacent PCI device ID, and everything worked well.
  
Now LSI is using some of the odd-numbered PCI device IDs between the 3Gb
SAS device IDs for their new MegaRAID cards.  This is causing the mpt(4)
driver to attach to the RAID cards instead of the mfi(4) driver.
  
The solution is to stop masking off the bottom bit of the device ID, and
explicitly list the PCI device IDs of all supported cards.
  
This change should be a no-op for mpt(4) hardware.  The only intended
functional change is that for the 929X, the is_fc variable gets set.  It
wasn't being set previously, but needs to be because the 929X is a Fibre
Channel card.
  
Reported by:Kashyap Desai 

Modified:
  stable/8/sys/dev/mpt/mpt_pci.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/dev/mpt/mpt_pci.c
==
--- stable/8/sys/dev/mpt/mpt_pci.c  Mon Mar  5 18:54:28 2012
(r232562)
+++ stable/8/sys/dev/mpt/mpt_pci.c  Mon Mar  5 19:01:23 2012
(r232563)
@@ -129,18 +129,34 @@ __FBSDID("$FreeBSD$");
 #definePCI_PRODUCT_LSI_FC919   0x0624
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC919_LAN
+#definePCI_PRODUCT_LSI_FC919_LAN   0x0625
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC929
 #definePCI_PRODUCT_LSI_FC929   0x0622
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC929_LAN
+#definePCI_PRODUCT_LSI_FC929_LAN   0x0623
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC929X
 #definePCI_PRODUCT_LSI_FC929X  0x0626
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC929X_LAN
+#definePCI_PRODUCT_LSI_FC929X_LAN  0x0627
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC919X
 #definePCI_PRODUCT_LSI_FC919X  0x0628
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC919X_LAN
+#definePCI_PRODUCT_LSI_FC919X_LAN  0x0629
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC7X04X
 #definePCI_PRODUCT_LSI_FC7X04X 0x0640
 #endif
@@ -153,6 +169,10 @@ __FBSDID("$FreeBSD$");
 #definePCI_PRODUCT_LSI_10300x0030
 #endif
 
+#ifndefPCI_PRODUCT_LSI_1030ZC
+#definePCI_PRODUCT_LSI_1030ZC  0x0031
+#endif
+
 #ifndefPCI_PRODUCT_LSI_SAS1064
 #define PCI_PRODUCT_LSI_SAS10640x0050
 #endif
@@ -177,6 +197,10 @@ __FBSDID("$FreeBSD$");
 #define PCI_PRODUCT_LSI_SAS10680x0054
 #endif
 
+#ifndef PCI_PRODUCT_LSI_SAS1068A
+#define PCI_PRODUCT_LSI_SAS1068A   0x0055
+#endif
+
 #ifndef PCI_PRODUCT_LSI_SAS1068E
 #define PCI_PRODUCT_LSI_SAS1068E   0x0058
 #endif
@@ -232,7 +256,7 @@ mpt_pci_probe(device_t dev)
return (ENXIO);
}
 
-   switch ((pci_get_device(dev) & ~1)) {
+   switch (pci_get_device(dev)) {
case PCI_PRODUCT_LSI_FC909:
desc = "LSILogic FC909 FC Adapter";
break;
@@ -242,15 +266,27 @@ mpt_pci_probe(device_t dev)
case PCI_PRODUCT_LSI_FC919:
desc = "LSILogic FC919 FC Adapter";
break;
+   case PCI_PRODUCT_LSI_FC919_LAN:
+   desc = "LSILogic FC919 LAN Adapter";
+   break;
case PCI_PRODUCT_LSI_FC929:
desc = "Dual LSILogic FC929 FC Adapter";
break;
+   case PCI_PRODUCT_LSI_FC929_LAN:
+   desc = "Dual LSILogic FC929 LAN Adapter";
+   break;
case PCI_PRODUCT_LSI_FC919X:
desc = "LSILogic FC919 FC PCI-X Adapter";
break;
+   case PCI_PRODUCT_LSI_FC919X_LAN:
+   desc = "LSILogic FC919 LAN PCI-X Adapter";
+   break;
case PCI_PRODUCT_LSI_FC929X:
desc = "Dual LSILogic FC929X 2Gb/s FC PCI-X Adapter";
break;
+   case PCI_PRODUCT_LSI_FC929X_LAN:
+   desc = "Dual LSILogic FC929X LAN PCI-X Adapter";
+   break;
case PCI_PRODUCT_LSI_FC646:
desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-Express Adapter";
break;
@@ -258,6 +294,7 @@ mpt_pci_probe(de

svn commit: r232632 - releng/8.3/sys/dev/mpt

2012-03-06 Thread Kenneth D. Merry
Author: ken
Date: Wed Mar  7 00:16:32 2012
New Revision: 232632
URL: http://svn.freebsd.org/changeset/base/232632

Log:
  Merge r232563 from stable/8 (r232411 from head):
  
Fix a problem that was causing the mpt(4) driver to attach to MegaRAID
cards that should be handled by the mfi(4) driver.
  
The root of the problem is that the mpt(4) driver was masking off the
bottom bit of the PCI device ID when deciding which cards to attach to.
  
It appears that a number of the mpt(4) Fibre Channel cards had a LAN
variant whose PCI device ID was just one bit off from the FC card's device
ID.  The FC cards were even and the LAN cards were odd.
  
The problem was that this pattern wasn't carried over on the SAS and
parallel SCSI mpt(4) cards.  Luckily the SAS and parallel SCSI PCI device
IDs were either even numbers, or they would get masked to a supported
adjacent PCI device ID, and everything worked well.
  
Now LSI is using some of the odd-numbered PCI device IDs between the 3Gb
SAS device IDs for their new MegaRAID cards.  This is causing the mpt(4)
driver to attach to the RAID cards instead of the mfi(4) driver.
  
The solution is to stop masking off the bottom bit of the device ID, and
explicitly list the PCI device IDs of all supported cards.
  
This change should be a no-op for mpt(4) hardware.  The only intended
functional change is that for the 929X, the is_fc variable gets set.  It
wasn't being set previously, but needs to be because the 929X is a Fibre
Channel card.
  
Reported by:Kashyap Desai 
  
  Approved by:  re (jpaetzel)

Modified:
  releng/8.3/sys/dev/mpt/mpt_pci.c
Directory Properties:
  releng/8.3/sys/   (props changed)

Modified: releng/8.3/sys/dev/mpt/mpt_pci.c
==
--- releng/8.3/sys/dev/mpt/mpt_pci.cTue Mar  6 23:37:53 2012
(r232631)
+++ releng/8.3/sys/dev/mpt/mpt_pci.cWed Mar  7 00:16:32 2012
(r232632)
@@ -129,18 +129,34 @@ __FBSDID("$FreeBSD$");
 #definePCI_PRODUCT_LSI_FC919   0x0624
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC919_LAN
+#definePCI_PRODUCT_LSI_FC919_LAN   0x0625
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC929
 #definePCI_PRODUCT_LSI_FC929   0x0622
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC929_LAN
+#definePCI_PRODUCT_LSI_FC929_LAN   0x0623
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC929X
 #definePCI_PRODUCT_LSI_FC929X  0x0626
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC929X_LAN
+#definePCI_PRODUCT_LSI_FC929X_LAN  0x0627
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC919X
 #definePCI_PRODUCT_LSI_FC919X  0x0628
 #endif
 
+#ifndefPCI_PRODUCT_LSI_FC919X_LAN
+#definePCI_PRODUCT_LSI_FC919X_LAN  0x0629
+#endif
+
 #ifndefPCI_PRODUCT_LSI_FC7X04X
 #definePCI_PRODUCT_LSI_FC7X04X 0x0640
 #endif
@@ -153,6 +169,10 @@ __FBSDID("$FreeBSD$");
 #definePCI_PRODUCT_LSI_10300x0030
 #endif
 
+#ifndefPCI_PRODUCT_LSI_1030ZC
+#definePCI_PRODUCT_LSI_1030ZC  0x0031
+#endif
+
 #ifndefPCI_PRODUCT_LSI_SAS1064
 #define PCI_PRODUCT_LSI_SAS10640x0050
 #endif
@@ -177,6 +197,10 @@ __FBSDID("$FreeBSD$");
 #define PCI_PRODUCT_LSI_SAS10680x0054
 #endif
 
+#ifndef PCI_PRODUCT_LSI_SAS1068A
+#define PCI_PRODUCT_LSI_SAS1068A   0x0055
+#endif
+
 #ifndef PCI_PRODUCT_LSI_SAS1068E
 #define PCI_PRODUCT_LSI_SAS1068E   0x0058
 #endif
@@ -232,7 +256,7 @@ mpt_pci_probe(device_t dev)
return (ENXIO);
}
 
-   switch ((pci_get_device(dev) & ~1)) {
+   switch (pci_get_device(dev)) {
case PCI_PRODUCT_LSI_FC909:
desc = "LSILogic FC909 FC Adapter";
break;
@@ -242,15 +266,27 @@ mpt_pci_probe(device_t dev)
case PCI_PRODUCT_LSI_FC919:
desc = "LSILogic FC919 FC Adapter";
break;
+   case PCI_PRODUCT_LSI_FC919_LAN:
+   desc = "LSILogic FC919 LAN Adapter";
+   break;
case PCI_PRODUCT_LSI_FC929:
desc = "Dual LSILogic FC929 FC Adapter";
break;
+   case PCI_PRODUCT_LSI_FC929_LAN:
+   desc = "Dual LSILogic FC929 LAN Adapter";
+   break;
case PCI_PRODUCT_LSI_FC919X:
desc = "LSILogic FC919 FC PCI-X Adapter";
break;
+   case PCI_PRODUCT_LSI_FC919X_LAN:
+   desc = "LSILogic FC919 LAN PCI-X Adapter";
+   break;
case PCI_PRODUCT_LSI_FC929X:
desc = "Dual LSILogic FC929X 2Gb/s FC PCI-X Adapter";
break;
+   case PCI_PRODUCT_LSI_FC929X_LAN:
+   desc = "Dual LSILogic FC929X LAN PCI-X Adapter";
+   break;
case PCI_PRODUCT_LSI_FC646:
desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-E

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

2016-02-08 Thread Kenneth D. Merry
Author: ken
Date: Mon Feb  8 22:13:08 2016
New Revision: 295417
URL: https://svnweb.freebsd.org/changeset/base/295417

Log:
  Fix the SCSI Extended INQUIRY probe case when an error is returned
  and a retry is scheduled.
  
  Instead of leaving the device queue frozen, unfreeze the device queue so
  that the retry can happen.
  
  Sponsored by: Spectra Logic
  MFC after:3 days

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

Modified: head/sys/cam/scsi/scsi_xpt.c
==
--- head/sys/cam/scsi/scsi_xpt.cMon Feb  8 22:02:56 2016
(r295416)
+++ head/sys/cam/scsi/scsi_xpt.cMon Feb  8 22:13:08 2016
(r295417)
@@ -1518,7 +1518,7 @@ out:
} else if (cam_periph_error(done_ccb, 0,
SF_RETRY_UA,
&softc->saved_ccb) == ERESTART) {
-   return;
+   goto outr;
} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
/* Don't wedge the queue */
xpt_release_devq(done_ccb->ccb_h.path, /*count*/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: r291716 - in head: share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/dev/md sys/geom sys/kern sys/pc98/include sys/sys usr.sbin usr.sbin/camdd

2015-12-03 Thread Kenneth D. Merry
Author: ken
Date: Thu Dec  3 20:54:55 2015
New Revision: 291716
URL: https://svnweb.freebsd.org/changeset/base/291716

Log:
  Add asynchronous command support to the pass(4) driver, and the new
  camdd(8) utility.
  
  CCBs may be queued to the driver via the new CAMIOQUEUE ioctl, and
  completed CCBs may be retrieved via the CAMIOGET ioctl.  User
  processes can use poll(2) or kevent(2) to get notification when
  I/O has completed.
  
  While the existing CAMIOCOMMAND blocking ioctl interface only
  supports user virtual data pointers in a CCB (generally only
  one per CCB), the new CAMIOQUEUE ioctl supports user virtual and
  physical address pointers, as well as user virtual and physical
  scatter/gather lists.  This allows user applications to have more
  flexibility in their data handling operations.
  
  Kernel memory for data transferred via the queued interface is
  allocated from the zone allocator in MAXPHYS sized chunks, and user
  data is copied in and out.  This is likely faster than the
  vmapbuf()/vunmapbuf() method used by the CAMIOCOMMAND ioctl in
  configurations with many processors (there are more TLB shootdowns
  caused by the mapping/unmapping operation) but may not be as fast
  as running with unmapped I/O.
  
  The new memory handling model for user requests also allows
  applications to send CCBs with request sizes that are larger than
  MAXPHYS.  The pass(4) driver now limits queued requests to the I/O
  size listed by the SIM driver in the maxio field in the Path
  Inquiry (XPT_PATH_INQ) CCB.
  
  There are some things things would be good to add:
  
  1. Come up with a way to do unmapped I/O on multiple buffers.
 Currently the unmapped I/O interface operates on a struct bio,
 which includes only one address and length.  It would be nice
 to be able to send an unmapped scatter/gather list down to
 busdma.  This would allow eliminating the copy we currently do
 for data.
  
  2. Add an ioctl to list currently outstanding CCBs in the various
 queues.
  
  3. Add an ioctl to cancel a request, or use the XPT_ABORT CCB to do
 that.
  
  4. Test physical address support.  Virtual pointers and scatter
 gather lists have been tested, but I have not yet tested
 physical addresses or scatter/gather lists.
  
  5. Investigate multiple queue support.  At the moment there is one
 queue of commands per pass(4) device.  If multiple processes
 open the device, they will submit I/O into the same queue and
 get events for the same completions.  This is probably the right
 model for most applications, but it is something that could be
 changed later on.
  
  Also, add a new utility, camdd(8) that uses the asynchronous pass(4)
  driver interface.
  
  This utility is intended to be a basic data transfer/copy utility,
  a simple benchmark utility, and an example of how to use the
  asynchronous pass(4) interface.
  
  It can copy data to and from pass(4) devices using any target queue
  depth, starting offset and blocksize for the input and ouptut devices.
  It currently only supports SCSI devices, but could be easily extended
  to support ATA devices.
  
  It can also copy data to and from regular files, block devices, tape
  devices, pipes, stdin, and stdout.  It does not support queueing
  multiple commands to any of those targets, since it uses the standard
  read(2)/write(2)/writev(2)/readv(2) system calls.
  
  The I/O is done by two threads, one for the reader and one for the
  writer.  The reader thread sends completed read requests to the
  writer thread in strictly sequential order, even if they complete
  out of order.  That could be modified later on for random I/O patterns
  or slightly out of order I/O.
  
  camdd(8) uses kqueue(2)/kevent(2) to get I/O completion events from
  the pass(4) driver and also to send request notifications internally.
  
  For pass(4) devcies, camdd(8) uses a single buffer (CAM_DATA_VADDR)
  per CAM CCB on the reading side, and a scatter/gather list
  (CAM_DATA_SG) on the writing side.  In addition to testing both
  interfaces, this makes any potential reblocking of I/O easier.  No
  data is copied between the reader and the writer, but rather the
  reader's buffers are split into multiple I/O requests or combined
  into a single I/O request depending on the input and output blocksize.
  
  For the file I/O path, camdd(8) also uses a single buffer (read(2),
  write(2), pread(2) or pwrite(2)) on reads, and a scatter/gather list
  (readv(2), writev(2), preadv(2), pwritev(2)) on writes.
  
  Things that would be nice to do for camdd(8) eventually:
  
  1.  Add support for I/O pattern generation.  Patterns like all
  zeros, all ones, LBA-based patterns, random patterns, etc. Right
  Now you can always use /dev/zero, /dev/random, etc.
  
  2.  Add support for a "sink" mode, so we do only reads with no
  writes.  Right now, you can use /dev/null.
  
  3.  Add support for automatic queue depth probi

Re: svn commit: r291716 - in head: share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/dev/md sys/geom sys/kern sys/pc98/include sys/sys usr.sbin usr.sbin/camdd

2015-12-03 Thread Kenneth D. Merry
On Thu, Dec 03, 2015 at 13:13:25 -0800, Bryan Drewery wrote:
> On 12/3/15 12:54 PM, Kenneth D. Merry wrote:
> > Author: ken
> > Date: Thu Dec  3 20:54:55 2015
> > New Revision: 291716
> > URL: https://svnweb.freebsd.org/changeset/base/291716
> > 
> > Log:
> >   Add asynchronous command support to the pass(4) driver, and the new
> >   camdd(8) utility.
> >   
> >   CCBs may be queued to the driver via the new CAMIOQUEUE ioctl, and
> >   completed CCBs may be retrieved via the CAMIOGET ioctl.  User
> >   processes can use poll(2) or kevent(2) to get notification when
> >   I/O has completed.
> >   
> >   While the existing CAMIOCOMMAND blocking ioctl interface only
> >   supports user virtual data pointers in a CCB (generally only
> >   one per CCB), the new CAMIOQUEUE ioctl supports user virtual and
> >   physical address pointers, as well as user virtual and physical
> >   scatter/gather lists.  This allows user applications to have more
> >   flexibility in their data handling operations.
> >   
> >   Kernel memory for data transferred via the queued interface is
> >   allocated from the zone allocator in MAXPHYS sized chunks, and user
> >   data is copied in and out.  This is likely faster than the
> >   vmapbuf()/vunmapbuf() method used by the CAMIOCOMMAND ioctl in
> >   configurations with many processors (there are more TLB shootdowns
> >   caused by the mapping/unmapping operation) but may not be as fast
> >   as running with unmapped I/O.
> >   
> >   The new memory handling model for user requests also allows
> >   applications to send CCBs with request sizes that are larger than
> >   MAXPHYS.  The pass(4) driver now limits queued requests to the I/O
> >   size listed by the SIM driver in the maxio field in the Path
> >   Inquiry (XPT_PATH_INQ) CCB.
> >   
> >   There are some things things would be good to add:
> >   
> >   1. Come up with a way to do unmapped I/O on multiple buffers.
> >  Currently the unmapped I/O interface operates on a struct bio,
> >  which includes only one address and length.  It would be nice
> >  to be able to send an unmapped scatter/gather list down to
> >  busdma.  This would allow eliminating the copy we currently do
> >  for data.
> >   
> >   2. Add an ioctl to list currently outstanding CCBs in the various
> >  queues.
> >   
> >   3. Add an ioctl to cancel a request, or use the XPT_ABORT CCB to do
> >  that.
> >   
> >   4. Test physical address support.  Virtual pointers and scatter
> >  gather lists have been tested, but I have not yet tested
> >  physical addresses or scatter/gather lists.
> >   
> >   5. Investigate multiple queue support.  At the moment there is one
> >  queue of commands per pass(4) device.  If multiple processes
> >  open the device, they will submit I/O into the same queue and
> >  get events for the same completions.  This is probably the right
> >  model for most applications, but it is something that could be
> >  changed later on.
> >   
> >   Also, add a new utility, camdd(8) that uses the asynchronous pass(4)
> >   driver interface.
> >   
> >   This utility is intended to be a basic data transfer/copy utility,
> >   a simple benchmark utility, and an example of how to use the
> >   asynchronous pass(4) interface.
> >   
> >   It can copy data to and from pass(4) devices using any target queue
> >   depth, starting offset and blocksize for the input and ouptut devices.
> >   It currently only supports SCSI devices, but could be easily extended
> >   to support ATA devices.
> >   
> >   It can also copy data to and from regular files, block devices, tape
> >   devices, pipes, stdin, and stdout.  It does not support queueing
> >   multiple commands to any of those targets, since it uses the standard
> >   read(2)/write(2)/writev(2)/readv(2) system calls.
> >   
> >   The I/O is done by two threads, one for the reader and one for the
> >   writer.  The reader thread sends completed read requests to the
> >   writer thread in strictly sequential order, even if they complete
> >   out of order.  That could be modified later on for random I/O patterns
> >   or slightly out of order I/O.
> >   
> >   camdd(8) uses kqueue(2)/kevent(2) to get I/O completion events from
> >   the pass(4) driver and also to send request notifications internally.
> >   
> >   For pass(4) devcies, camdd(8) uses a single buffer (CAM_DATA_VADDR)
> >   per CAM CCB on the reading s

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

2015-12-03 Thread Kenneth D. Merry
Author: ken
Date: Thu Dec  3 22:07:01 2015
New Revision: 291724
URL: https://svnweb.freebsd.org/changeset/base/291724

Log:
  Fix typos in the camdd(8) usage() function output caused by an error in
  my diff filter script.
  
  Sponsored by: Spectra Logic
  MFC after:1 week

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

Modified: head/usr.sbin/camdd/camdd.c
==
--- head/usr.sbin/camdd/camdd.c Thu Dec  3 21:25:59 2015(r291723)
+++ head/usr.sbin/camdd/camdd.c Thu Dec  3 22:07:01 2015(r291724)
@@ -3205,7 +3205,7 @@ usage(void)
 "-o   Specify output device/file and parameters\n"
 "Input and Output parameters\n"
 "pass=name Specify a pass(4) device like pass0 or /dev/pass0\n"
-"file=name Specify a file or device, src/usr.sbin/camdd/camdd.c, /dev/da0, 
/dev/null\n"
+"file=name Specify a file or device, /tmp/foo, /dev/da0, /dev/null\n"
 "  or - for stdin/stdout\n"
 "bs=blocksize  Specify blocksize in bytes, or using K, M, G, etc. suffix\n"
 "offset=lenSpecify starting offset in bytes or using K, M, G suffix\n"
___
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: r291741 - head/sys/geom

2015-12-03 Thread Kenneth D. Merry
Author: ken
Date: Fri Dec  4 03:38:35 2015
New Revision: 291741
URL: https://svnweb.freebsd.org/changeset/base/291741

Log:
  Fix g_disk_vlist_limit() to work properly with deletes.
  
  Add a new bp argument to g_disk_maxsegs(), and add a new function,
  g_disk_maxsize() tha will properly determine the maximum I/O size for a
  delete or non-delete bio.
  
  Submitted by: will
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/sys/geom/geom_disk.c

Modified: head/sys/geom/geom_disk.c
==
--- head/sys/geom/geom_disk.c   Fri Dec  4 03:18:02 2015(r291740)
+++ head/sys/geom/geom_disk.c   Fri Dec  4 03:38:35 2015(r291741)
@@ -253,10 +253,18 @@ g_disk_ioctl(struct g_provider *pp, u_lo
return (error);
 }
 
+static off_t
+g_disk_maxsize(struct disk *dp, struct bio *bp)
+{
+   if (bp->bio_cmd == BIO_DELETE)
+   return (dp->d_delmaxsize);
+   return (dp->d_maxsize);
+}
+
 static int
-g_disk_maxsegs(struct disk *dp)
+g_disk_maxsegs(struct disk *dp, struct bio *bp)
 {
-   return ((dp->d_maxsize / PAGE_SIZE) + 1);
+   return ((g_disk_maxsize(dp, bp) / PAGE_SIZE) + 1);
 }
 
 static void
@@ -334,7 +342,7 @@ g_disk_vlist_limit(struct disk *dp, stru
end = (bus_dma_segment_t *)bp->bio_data + bp->bio_ma_n;
residual = bp->bio_length;
offset = bp->bio_ma_offset;
-   pages = g_disk_maxsegs(dp);
+   pages = g_disk_maxsegs(dp, bp);
while (residual != 0 && pages != 0) {
KASSERT((seg != end),
("vlist limit runs off the end"));
@@ -350,10 +358,7 @@ static bool
 g_disk_limit(struct disk *dp, struct bio *bp)
 {
bool limited = false;
-   off_t d_maxsize;
-
-   d_maxsize = (bp->bio_cmd == BIO_DELETE) ?
-   dp->d_delmaxsize : dp->d_maxsize;
+   off_t maxsz = g_disk_maxsize(dp, bp);
 
/*
 * XXX: If we have a stripesize we should really use it here.
@@ -361,8 +366,8 @@ g_disk_limit(struct disk *dp, struct bio
 *  as deletes can be very sensitive to size given how they
 *  are processed.
 */
-   if (bp->bio_length > d_maxsize) {
-   bp->bio_length = d_maxsize;
+   if (bp->bio_length > maxsz) {
+   bp->bio_length = maxsz;
limited = true;
}
 
___
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: r291742 - head/sys/geom

2015-12-03 Thread Kenneth D. Merry
Author: ken
Date: Fri Dec  4 03:44:12 2015
New Revision: 291742
URL: https://svnweb.freebsd.org/changeset/base/291742

Log:
  Fix a style issue in g_disk_limit().
  
  Noticed by:   bdrewery
  MFC after:1 week

Modified:
  head/sys/geom/geom_disk.c

Modified: head/sys/geom/geom_disk.c
==
--- head/sys/geom/geom_disk.c   Fri Dec  4 03:38:35 2015(r291741)
+++ head/sys/geom/geom_disk.c   Fri Dec  4 03:44:12 2015(r291742)
@@ -358,7 +358,9 @@ static bool
 g_disk_limit(struct disk *dp, struct bio *bp)
 {
bool limited = false;
-   off_t maxsz = g_disk_maxsize(dp, bp);
+   off_t maxsz;
+
+   maxsz = g_disk_maxsize(dp, bp);
 
/*
 * XXX: If we have a stripesize we should really use it here.
___
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: r291741 - head/sys/geom

2015-12-03 Thread Kenneth D. Merry
On Thu, Dec 03, 2015 at 19:41:31 -0800, Bryan Drewery wrote:
> On 12/3/2015 7:38 PM, Kenneth D. Merry wrote:
> >  g_disk_limit(struct disk *dp, struct bio *bp)
> >  {
> > bool limited = false;
> > -   off_t d_maxsize;
> > -
> > -   d_maxsize = (bp->bio_cmd == BIO_DELETE) ?
> > -   dp->d_delmaxsize : dp->d_maxsize;
> > +   off_t maxsz = g_disk_maxsize(dp, bp);
> 
> This looks like a style issue.

You are correct.  Fixed.

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"


Re: svn commit: r291716 - in head: share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/dev/md sys/geom sys/kern sys/pc98/include sys/sys usr.sbin usr.sbin/camdd

2015-12-04 Thread Kenneth D. Merry
On Thu, Dec 03, 2015 at 23:55:14 -0800, Ravi Pokala wrote:
> Hi Ken,
> 
> A few questions:
> 
> > Although these ioctls do not have a declared argument, they
> > both take a union ccb pointer.  If we declare a size here,
> > the ioctl code in sys/kern/sys_generic.c will malloc and free
> > a buffer for either the CCB or the CCB pointer (depending on
> > how it is declared).  Since we have to keep a copy of the
> > CCB (which is fairly large) anyway, having the ioctl malloc
> > and free a CCB for each call is wasteful.
> 
> 
> (a) How does that work? That is, how does the argument get to the ioctl 
> handler in the kernel?
> 

In sys_ioctl(), in sys/kern/sys_generic.c, the pointer argument ("data") to
the ioctl syscall is passed through into kern_ioctl() and then on down
until it gets into the passioctl() call.  It is passed through even when
the declared size of the ioctl is 0, as it is for the two new ioctls:

/*
 * These two ioctls take a union ccb *, but that is not explicitly declared
 * to avoid having the ioctl handling code malloc and free their own copy
 * of the CCB or the CCB pointer.
 */
#define CAMIOQUEUE  _IO(CAM_VERSION, 4)
#define CAMIOGET_IO(CAM_VERSION, 5)

Here's the code in question:

if (size > 0) {
if (com & IOC_VOID) {
/* Integer argument. */
arg = (intptr_t)uap->data;
data = (void *)&arg;
size = 0;
} else {
if (size > SYS_IOCTL_SMALL_SIZE)
data = malloc((u_long)size, M_IOCTLOPS, M_WAITOK
);  
else
data = smalldata;
}
} else
data = (void *)&uap->data;

So in the size == 0 case, data is just passed through as is.

Prior to r274017, if the ioctl were declared as _IOWR, there would be a
malloc and copyin of however much data is declared in the ioctl, no matter
what the size.  So, in this case, sizeof(union ccb *) or sizeof(union ccb).

The problem is, upon exit from the ioctl, that data is freed.  With a
queueing interface, we need to keep a copy of the CCB around after the
ioctl exits.  You have the same problem even after r274017, because that
just provides a small buffer on the stack.  (And would only help in the
pointer case.  And we don't need to copyin the pointer.)

So, to avoid that, we don't declare an argument, but we do pass in a
pointer and do the copy the user's CCB into a CCB that is allocated inside
the pass(4) driver.

> (b) The CCB is large, but the CCB pointer is just a pointer; shouldn't that 
> be passed in as the arg?
> 

It is.  Here's what camdd(8) does:

>From camdd_pass_run():

union ccb *ccb;
...
/*
 * Queue the CCB to the pass(4) driver.
 */
if (ioctl(pass_dev->dev->fd, CAMIOQUEUE, ccb) == -1) {

And from camdd_pass_fetch():

union ccb ccb;
...
while ((retval = ioctl(pass_dev->dev->fd, CAMIOGET, &ccb)) != -1) {

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: r291960 - head/sys/cam

2015-12-07 Thread Kenneth D. Merry
Author: ken
Date: Mon Dec  7 21:04:27 2015
New Revision: 291960
URL: https://svnweb.freebsd.org/changeset/base/291960

Log:
  The ccb_xflags enumeration was removed from FreeBSD/head in
  r259397 (it contained the CAM_EXTLUN_VALID bit) and I added the
  same type name with a different set of values back in r291716.
  
  The old ccb_xflags enumeration still exists in FreeBSD stable/10.
  Shift all of the new values by one bit to avoid compatibility
  issues when merged to stable/10.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/cam_ccb.h

Modified: head/sys/cam/cam_ccb.h
==
--- head/sys/cam/cam_ccb.h  Mon Dec  7 20:48:28 2015(r291959)
+++ head/sys/cam/cam_ccb.h  Mon Dec  7 21:04:27 2015(r291960)
@@ -110,9 +110,9 @@ typedef enum {
 } ccb_flags;
 
 typedef enum {
-   CAM_USER_DATA_ADDR  = 0x0001,/* Userspace data pointers */
-   CAM_SG_FORMAT_IOVEC = 0x0002,/* iovec instead of busdma S/G*/
-   CAM_UNMAPPED_BUF= 0x0004 /* use unmapped I/O */
+   CAM_USER_DATA_ADDR  = 0x0002,/* Userspace data pointers */
+   CAM_SG_FORMAT_IOVEC = 0x0004,/* iovec instead of busdma S/G*/
+   CAM_UNMAPPED_BUF= 0x0008 /* use unmapped I/O */
 } ccb_xflags;
 
 /* XPT Opcodes for xpt_action */
___
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: r284192 - in head: lib/libsbuf lib/libutil sbin/camcontrol share/man/man9 sys/cam sys/cam/scsi sys/kern sys/sys

2015-06-09 Thread Kenneth D. Merry
Author: ken
Date: Tue Jun  9 21:39:38 2015
New Revision: 284192
URL: https://svnweb.freebsd.org/changeset/base/284192

Log:
  Add support for reading MAM attributes to camcontrol(8) and libcam(3).
  
  MAM is Medium Auxiliary Memory and is most commonly found as flash
  chips on tapes.
  
  This includes support for reading attributes and decoding most
  known attributes, but does not yet include support for writing
  attributes or reporting attributes in XML format.
  
  libsbuf/Makefile:
Add subr_prf.c for the new sbuf_hexdump() function.  This
function is essentially the same function.
  
  libsbuf/Symbol.map:
Add a new shared library minor version, and include the
sbuf_hexdump() function.
  
  libsbuf/Version.def:
Add version 1.4 of the libsbuf library.
  
  libutil/hexdump.3:
Document sbuf_hexdump() alongside hexdump(3), since it is
essentially the same function.
  
  camcontrol/Makefile:
Add attrib.c.
  
  camcontrol/attrib.c:
Implementation of READ ATTRIBUTE support for camcontrol(8).
  
  camcontrol/camcontrol.8:
Document the new 'camcontrol attrib' subcommand.
  
  camcontrol/camcontrol.c:
Add the new 'camcontrol attrib' subcommand.
  
  camcontrol/camcontrol.h:
Add a function prototype for scsiattrib().
  
  share/man/man9/sbuf.9:
Document the existence of sbuf_hexdump() and point users to
the hexdump(3) man page for more details.
  
  sys/cam/scsi/scsi_all.c:
Add a table of known attributes, text descriptions and
handler functions.
  
Add a new scsi_attrib_sbuf() function along with a number
of other related functions that help decode attributes.
  
scsi_attrib_ascii_sbuf() decodes ASCII format attributes.
  
scsi_attrib_int_sbuf() decodes binary format attributes, and
will pass them off to scsi_attrib_hexdump_sbuf() if they're
bigger than 8 bytes.
  
scsi_attrib_vendser_sbuf() decodes the vendor and drive
serial number attribute.
  
scsi_attrib_volcoh_sbuf() decodes the Volume Coherency
Information attribute that LTFS writes out.
  
  sys/cam/scsi/scsi_all.h:
Add a number of attribute-related structure definitions and
other defines.
  
Add function prototypes for all of the functions added in
scsi_all.c.
  
  sys/kern/subr_prf.c:
Add a new function, sbuf_hexdump().  This is the same as
the existing hexdump(9) function, except that it puts the
result in an sbuf.
  
This also changes subr_prf.c so that it can be compiled in
userland for includsion in libsbuf.
  
We should work to change this so that the kernel hexdump
implementation is a wrapper around sbuf_hexdump() with a
statically allocated sbuf with a drain.  That will require
a drain function that goes to the kernel printf() buffer
that can take a non-NUL terminated string as input.
That is because an sbuf isn't NUL-terminated until it is
finished, and we don't want to finish it while we're still
using it.
  
We should also work to consolidate the userland hexdump and
kernel hexdump implemenatations, which are currently
separate.  This would also mean making applications that
currently link in libutil link in libsbuf.
  
  sys/sys/sbuf.h:
Add the prototype for sbuf_hexdump(), and add another copy
of the hexdump flag values if they aren't already defined.
  
Ideally the flags should be defined in one place but the
implemenation makes it difficult to do properly.  (See
above.)
  
  Sponsored by: Spectra Logic Corporation
  MFC after:1 week

Added:
  head/sbin/camcontrol/attrib.c   (contents, props changed)
Modified:
  head/lib/libsbuf/Makefile
  head/lib/libsbuf/Symbol.map
  head/lib/libsbuf/Version.def
  head/lib/libutil/hexdump.3
  head/sbin/camcontrol/Makefile
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c
  head/sbin/camcontrol/camcontrol.h
  head/share/man/man9/sbuf.9
  head/sys/cam/cam.c
  head/sys/cam/cam.h
  head/sys/cam/scsi/scsi_all.c
  head/sys/cam/scsi/scsi_all.h
  head/sys/kern/subr_prf.c
  head/sys/sys/sbuf.h

Modified: head/lib/libsbuf/Makefile
==
--- head/lib/libsbuf/Makefile   Tue Jun  9 19:41:16 2015(r284191)
+++ head/lib/libsbuf/Makefile   Tue Jun  9 21:39:38 2015(r284192)
@@ -2,7 +2,7 @@
 
 LIB=   sbuf
 SHLIBDIR?= /lib
-SRCS=  subr_sbuf.c 
+SRCS=  subr_prf.c subr_sbuf.c
 
 SHLIB_MAJOR= 6
 

Modified: head/lib/libsbuf/Symbol.map
==
--- head/lib/libsbuf/Symbol.map Tue Jun  9 19:41:16 2015(r284191)
+++ head/lib/libsbuf/Symbol.map Tue Jun  9 21:39:38 2015(r284192)
@@ -27,3 +27,7

svn commit: r284435 - in stable/10: lib/libsbuf lib/libutil sbin/camcontrol share/man/man9 sys/cam sys/cam/scsi sys/kern sys/sys

2015-06-15 Thread Kenneth D. Merry
Author: ken
Date: Tue Jun 16 02:31:11 2015
New Revision: 284435
URL: https://svnweb.freebsd.org/changeset/base/284435

Log:
  MFC, r284192:
  

r284192 | ken | 2015-06-09 15:39:38 -0600 (Tue, 09 Jun 2015) | 102 lines
  
Add support for reading MAM attributes to camcontrol(8) and libcam(3).
  
MAM is Medium Auxiliary Memory and is most commonly found as flash
chips on tapes.
  
This includes support for reading attributes and decoding most
known attributes, but does not yet include support for writing
attributes or reporting attributes in XML format.
  
libsbuf/Makefile:
Add subr_prf.c for the new sbuf_hexdump() function.  This
function is essentially the same function.
  
libsbuf/Symbol.map:
Add a new shared library minor version, and include the
sbuf_hexdump() function.
  
libsbuf/Version.def:
Add version 1.4 of the libsbuf library.
  
libutil/hexdump.3:
Document sbuf_hexdump() alongside hexdump(3), since it is
essentially the same function.
  
camcontrol/Makefile:
Add attrib.c.
  
camcontrol/attrib.c:
Implementation of READ ATTRIBUTE support for camcontrol(8).
  
camcontrol/camcontrol.8:
Document the new 'camcontrol attrib' subcommand.
  
camcontrol/camcontrol.c:
Add the new 'camcontrol attrib' subcommand.
  
camcontrol/camcontrol.h:
Add a function prototype for scsiattrib().
  
share/man/man9/sbuf.9:
Document the existence of sbuf_hexdump() and point users to
the hexdump(3) man page for more details.
  
sys/cam/scsi/scsi_all.c:
Add a table of known attributes, text descriptions and
handler functions.
  
Add a new scsi_attrib_sbuf() function along with a number
of other related functions that help decode attributes.
  
scsi_attrib_ascii_sbuf() decodes ASCII format attributes.
  
scsi_attrib_int_sbuf() decodes binary format attributes, and
will pass them off to scsi_attrib_hexdump_sbuf() if they're
bigger than 8 bytes.
  
scsi_attrib_vendser_sbuf() decodes the vendor and drive
serial number attribute.
  
scsi_attrib_volcoh_sbuf() decodes the Volume Coherency
Information attribute that LTFS writes out.
  
sys/cam/scsi/scsi_all.h:
Add a number of attribute-related structure definitions and
other defines.
  
Add function prototypes for all of the functions added in
scsi_all.c.
  
sys/kern/subr_prf.c:
Add a new function, sbuf_hexdump().  This is the same as
the existing hexdump(9) function, except that it puts the
result in an sbuf.
  
This also changes subr_prf.c so that it can be compiled in
userland for includsion in libsbuf.
  
We should work to change this so that the kernel hexdump
implementation is a wrapper around sbuf_hexdump() with a
statically allocated sbuf with a drain.  That will require
a drain function that goes to the kernel printf() buffer
that can take a non-NUL terminated string as input.
That is because an sbuf isn't NUL-terminated until it is
finished, and we don't want to finish it while we're still
using it.
  
We should also work to consolidate the userland hexdump and
kernel hexdump implemenatations, which are currently
separate.  This would also mean making applications that
currently link in libutil link in libsbuf.
  
sys/sys/sbuf.h:
Add the prototype for sbuf_hexdump(), and add another copy
of the hexdump flag values if they aren't already defined.
  
Ideally the flags should be defined in one place but the
implemenation makes it difficult to do properly.  (See
above.)
  
Sponsored by:   Spectra Logic Corporation
  
  

Added:
  stable/10/sbin/camcontrol/attrib.c
 - copied unchanged from r284192, head/sbin/camcontrol/attrib.c
Modified:
  stable/10/lib/libsbuf/Makefile
  stable/10/lib/libsbuf/Symbol.map
  stable/10/lib/libsbuf/Version.def
  stable/10/lib/libutil/hexdump.3
  stable/10/sbin/camcontrol/Makefile
  stable/10/sbin/camcontrol/camcontrol.8
  stable/10/sbin/camcontrol/camcontrol.c
  stable/10/sbin/camcontrol/camcontrol.h
  stable/10/share/man/man9/sbuf.9
  stable/10/sys/cam/cam.c
  stable/10/sys/cam/cam.h
  stable/10/sys/cam/scsi/scsi_all.c
  stable/10/sys/cam/scsi/scsi_all.h
  stable/10/sys/kern/subr_prf.c
  stable/10/sys/sys/sbuf.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libsbuf/Makefile
==
--- stable/10/lib/libsbuf/Makefile  Mon Jun 15 23:30:54 2015
(r284434)
+++ stable/10/lib/libsbuf/Makefile  

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

2016-02-19 Thread Kenneth D. Merry
Author: ken
Date: Fri Feb 19 17:14:34 2016
New Revision: 295819
URL: https://svnweb.freebsd.org/changeset/base/295819

Log:
  MFC, r295417:
  
r295417 | ken | 2016-02-08 15:13:08 -0700 (Mon, 08 Feb 2016) | 9 lines
  
Fix the SCSI Extended INQUIRY probe case when an error is returned
and a retry is scheduled.
  
Instead of leaving the device queue frozen, unfreeze the device queue so
that the retry can happen.
  
Sponsored by:   Spectra Logic
  
  Approved by:  re (gjb)

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

Modified: stable/10/sys/cam/scsi/scsi_xpt.c
==
--- stable/10/sys/cam/scsi/scsi_xpt.c   Fri Feb 19 16:56:07 2016
(r295818)
+++ stable/10/sys/cam/scsi/scsi_xpt.c   Fri Feb 19 17:14:34 2016
(r295819)
@@ -1521,7 +1521,7 @@ out:
} else if (cam_periph_error(done_ccb, 0,
SF_RETRY_UA,
&softc->saved_ccb) == ERESTART) {
-   return;
+   goto outr;
} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
/* Don't wedge the queue */
xpt_release_devq(done_ccb->ccb_h.path, /*count*/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: r286965 - in head: sbin/camcontrol sys/cam/scsi

2015-08-20 Thread Kenneth D. Merry
Author: ken
Date: Thu Aug 20 16:07:51 2015
New Revision: 286965
URL: https://svnweb.freebsd.org/changeset/base/286965

Log:
  Revamp camcontrol(8) fwdownload support and add the opcodes subcommand.
  
  The significant changes and bugs fixed here are:
  
  1. Fixed a bug in the progress display code:
  
 When the user's filename is too big, or his terminal width is too
 small, the progress code could wind up using a negative number for
 the length of the "stars" that it uses to indicate progress.
  
 This negative value was assigned to an unsigned variable, resulting
 in a very large positive value.
  
 The result is that we wound up writing garbage from memory to the
 user's terminal.
  
 With an 80 column terminal, a file name length of more than 35
 characters would generate this problem.
  
 To address this, we now set a minimum progress bar length, and
 truncate the user's file name as needed.
  
 This has been tested with large filenames and small terminals, and
 at least produces reasonable results.  If the terminal is too
 narrow, the progress display takes up an additional line with each
 update, but this is more user friendly than writing garbage to the
 tty.
  
  2. SATA drives connected via a SATA controller didn't have SCSI Inquiry
 data populated in struct cam_device.  This meant that the code in
 fw_get_vendor() in fwdownload.c would try to match a zero-length
 vendor ID, and so return the first entry in the vendor table.  (Which
 used to be HITACHI.)  Fixed by grabbing identify data, passing the
 identify buffer into fw_get_vendor(), and matching against the model
 name.
  
  3. SATA drives connected via a SAS controller do have Inquiry data
 populated.  The table included a couple of entries -- "ATA ST" and
 "ATA HDS", intended to handle Seagate and Hitachi SATA drives attached
 via a SAS controller.  SCSI to ATA translation layers use a vendor
 ID of "ATA" (which is standard), and then the model name from the ATA
 identify data as the SCSI product name when they are returning data on
 SATA disks.  The cam_strmatch code will match the first part of the
 string (because the length it is given is the length of the vendor,
 "ATA"), and return 0 (i.e. a match).  So all SATA drives attached to
 a SAS controller would be programmed using the Seagate method
 (WRITE BUFFER mode 7) of SCSI firmware downloading.
  
  4. Issue #2 above covered up a bug in fw_download_img() -- if the
 maximum packet size in the vendor table was 0, it tried to default
 to a packet size of 32K.  But then it didn't actually succeed in
 doing that, because it set the packet size to the value that was
 in the vendor table (0).  Now that we actually have ATA attached
 drives fall use the VENDOR_ATA case, we need a reasonable default
 packet size.  So this is fixed to properly set the default packet size.
  
  5. Add support for downloading firmware to IBM LTO drives, and add a
 firmware file validation method to make sure that the firmware
 file matches the drive type.  IBM tape drives include a Load ID and
 RU name in their vendor-specific VPD page 0x3.  Those should match
 the IDs in the header of the firmware file to insure that the
 proper firmware file is loaded.
  
  6. This also adds a new -q option to the camcontrol fwdownload
 subcommand to suppress informational output.  When -q is used in
 combination with -y, the firmware upgrade will happen without
 prompting and without output except if an error condition occurs.
  
  7. Re-add support for printing out SCSI inquiry information when
 asking the user to confirm that they want to download firmware, and
 add printing of ATA Identify data if it is a SATA disk.  This was
 removed in r237281 when support for flashing ATA disks was added.
  
  8. Add a new camcontrol(8) "opcodes" subcommand, and use the
 underlying code to get recommended timeout values for drive
 firmware downloads.
  
 Many SCSI devices support the REPORT SUPPORTED OPERATION CODES
 command, and some support the optional timeout descriptor that
 specifies nominal and recommended timeouts for the commands
 supported by the device.
  
 The new camcontrol opcodes subcommand allows displaying all
 opcodes supported by a drive, information about which fields
 in a SCSI CDB are actually used by a given SCSI device, and the
 nominal and recommended timeout values for each command.
  
 Since firmware downloads can take a long time in some devices, and
 the time varies greatly between different types of devices, take
 advantage of the infrastructure used by the camcontrol opcodes
 subcommand to determine the best timeout to use for the WRITE
 BUFFER command in SCSI device firmware downloads.
  
 If the device recommends a timeout, it is likely to be more

svn commit: r287203 - in stable/10: sbin/camcontrol sys/cam/scsi

2015-08-27 Thread Kenneth D. Merry
Author: ken
Date: Thu Aug 27 13:17:05 2015
New Revision: 287203
URL: https://svnweb.freebsd.org/changeset/base/287203

Log:
  MFC, r286965:
  

r286965 | ken | 2015-08-20 10:07:51 -0600 (Thu, 20 Aug 2015) | 297 lines
  
Revamp camcontrol(8) fwdownload support and add the opcodes subcommand.
  
The significant changes and bugs fixed here are:
  
1. Fixed a bug in the progress display code:
  
   When the user's filename is too big, or his terminal width is too
   small, the progress code could wind up using a negative number for
   the length of the "stars" that it uses to indicate progress.
  
   This negative value was assigned to an unsigned variable, resulting
   in a very large positive value.
  
   The result is that we wound up writing garbage from memory to the
   user's terminal.
  
   With an 80 column terminal, a file name length of more than 35
   characters would generate this problem.
  
   To address this, we now set a minimum progress bar length, and
   truncate the user's file name as needed.
  
   This has been tested with large filenames and small terminals, and
   at least produces reasonable results.  If the terminal is too
   narrow, the progress display takes up an additional line with each
   update, but this is more user friendly than writing garbage to the
   tty.
  
2. SATA drives connected via a SATA controller didn't have SCSI Inquiry
   data populated in struct cam_device.  This meant that the code in
   fw_get_vendor() in fwdownload.c would try to match a zero-length
   vendor ID, and so return the first entry in the vendor table.  (Which
   used to be HITACHI.)  Fixed by grabbing identify data, passing the
   identify buffer into fw_get_vendor(), and matching against the model
   name.
  
3. SATA drives connected via a SAS controller do have Inquiry data
   populated.  The table included a couple of entries -- "ATA ST" and
   "ATA HDS", intended to handle Seagate and Hitachi SATA drives attached
   via a SAS controller.  SCSI to ATA translation layers use a vendor
   ID of "ATA" (which is standard), and then the model name from the ATA
   identify data as the SCSI product name when they are returning data on
   SATA disks.  The cam_strmatch code will match the first part of the
   string (because the length it is given is the length of the vendor,
   "ATA"), and return 0 (i.e. a match).  So all SATA drives attached to
   a SAS controller would be programmed using the Seagate method
   (WRITE BUFFER mode 7) of SCSI firmware downloading.
  
4. Issue #2 above covered up a bug in fw_download_img() -- if the
   maximum packet size in the vendor table was 0, it tried to default
   to a packet size of 32K.  But then it didn't actually succeed in
   doing that, because it set the packet size to the value that was
   in the vendor table (0).  Now that we actually have ATA attached
   drives fall use the VENDOR_ATA case, we need a reasonable default
   packet size.  So this is fixed to properly set the default packet size.
  
5. Add support for downloading firmware to IBM LTO drives, and add a
   firmware file validation method to make sure that the firmware
   file matches the drive type.  IBM tape drives include a Load ID and
   RU name in their vendor-specific VPD page 0x3.  Those should match
   the IDs in the header of the firmware file to insure that the
   proper firmware file is loaded.
  
6. This also adds a new -q option to the camcontrol fwdownload
   subcommand to suppress informational output.  When -q is used in
   combination with -y, the firmware upgrade will happen without
   prompting and without output except if an error condition occurs.
  
7. Re-add support for printing out SCSI inquiry information when
   asking the user to confirm that they want to download firmware, and
   add printing of ATA Identify data if it is a SATA disk.  This was
   removed in r237281 when support for flashing ATA disks was added.
  
8. Add a new camcontrol(8) "opcodes" subcommand, and use the
   underlying code to get recommended timeout values for drive
   firmware downloads.
  
   Many SCSI devices support the REPORT SUPPORTED OPERATION CODES
   command, and some support the optional timeout descriptor that
   specifies nominal and recommended timeouts for the commands
   supported by the device.
  
   The new camcontrol opcodes subcommand allows displaying all
   opcodes supported by a drive, information about which fields
   in a SCSI CDB are actually used by a given SCSI device, and the
   nominal and recommended timeout values for each command.
  
   Since firmware downloads can take a long time in some devices, and
   the 

Re: svn commit: r287621 - in head/sys: cam/ctl conf modules/ctl

2015-09-11 Thread Kenneth D. Merry
On Thu, Sep 10, 2015 at 12:40:32 +, Alexander Motin wrote:
> Author: mav
> Date: Thu Sep 10 12:40:31 2015
> New Revision: 287621
> URL: https://svnweb.freebsd.org/changeset/base/287621
> 
> Log:
>   Reimplement CTL High Availability.
>   
>   CTL HA functionality was originally implemented by Copan many years ago,
>   but large part of the sources was never published.  This change includes
>   clean room implementation of the missing code and fixes for many bugs.
>   
>   This code supports dual-node HA with ALUA in four modes:
>- Active/Unavailable without interlink between nodes;
>- Active/Standby with second node handling only basic LUN discovery and
>   reservation, synchronizing with the first node through the interlink;
>- Active/Active with both nodes processing commands and accessing the
>   backing storage, synchronizing with the first node through the interlink;
>- Active/Active with second node working as proxy, transfering all
>   commands to the first node for execution through the interlink.
>   
>   Unlike original Copan's implementation, depending on specific hardware,
>   this code uses simple custom TCP-based protocol for interlink.  It has
>   no authentication, so it should never be enabled on public interfaces.
>   
>   The code may still need some polishing, but generally it is functional.
>   
>   Relnotes:   yes
>   Sponsored by:   iXsystems, Inc.

Wow, very cool!

Thank you for doing that, and thanks to iX for sponsoring it!

I was hoping that someone would pick up the HA work years ago when I put in
those stubs, and I'm very glad that you have done the work!

This will be great functionality for FreeBSD!

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: r292348 - in stable/10: share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/dev/md sys/geom sys/ia64/include sys/kern sys/pc98/include sys/sys usr.sbin usr.sbin/camdd

2015-12-16 Thread Kenneth D. Merry
Author: ken
Date: Wed Dec 16 19:01:14 2015
New Revision: 292348
URL: https://svnweb.freebsd.org/changeset/base/292348

Log:
  MFC r291716, r291724, r291741, r291742
  
  In addition to those revisions, add this change to a file that is not in
  head:
  
  sys/ia64/include/bus.h:
Guard kernel-only parts of the ia64 machine/bus.h header with
#ifdef _KERNEL.
  
This allows userland programs to include  to get the
definition of bus_addr_t and bus_size_t.
  

r291716 | ken | 2015-12-03 15:54:55 -0500 (Thu, 03 Dec 2015) | 257 lines
  
Add asynchronous command support to the pass(4) driver, and the new
camdd(8) utility.
  
CCBs may be queued to the driver via the new CAMIOQUEUE ioctl, and
completed CCBs may be retrieved via the CAMIOGET ioctl.  User
processes can use poll(2) or kevent(2) to get notification when
I/O has completed.
  
While the existing CAMIOCOMMAND blocking ioctl interface only
supports user virtual data pointers in a CCB (generally only
one per CCB), the new CAMIOQUEUE ioctl supports user virtual and
physical address pointers, as well as user virtual and physical
scatter/gather lists.  This allows user applications to have more
flexibility in their data handling operations.
  
Kernel memory for data transferred via the queued interface is
allocated from the zone allocator in MAXPHYS sized chunks, and user
data is copied in and out.  This is likely faster than the
vmapbuf()/vunmapbuf() method used by the CAMIOCOMMAND ioctl in
configurations with many processors (there are more TLB shootdowns
caused by the mapping/unmapping operation) but may not be as fast
as running with unmapped I/O.
  
The new memory handling model for user requests also allows
applications to send CCBs with request sizes that are larger than
MAXPHYS.  The pass(4) driver now limits queued requests to the I/O
size listed by the SIM driver in the maxio field in the Path
Inquiry (XPT_PATH_INQ) CCB.
  
There are some things things would be good to add:
  
1. Come up with a way to do unmapped I/O on multiple buffers.
   Currently the unmapped I/O interface operates on a struct bio,
   which includes only one address and length.  It would be nice
   to be able to send an unmapped scatter/gather list down to
   busdma.  This would allow eliminating the copy we currently do
   for data.
  
2. Add an ioctl to list currently outstanding CCBs in the various
   queues.
  
3. Add an ioctl to cancel a request, or use the XPT_ABORT CCB to do
   that.
  
4. Test physical address support.  Virtual pointers and scatter
   gather lists have been tested, but I have not yet tested
   physical addresses or scatter/gather lists.
  
5. Investigate multiple queue support.  At the moment there is one
   queue of commands per pass(4) device.  If multiple processes
   open the device, they will submit I/O into the same queue and
   get events for the same completions.  This is probably the right
   model for most applications, but it is something that could be
   changed later on.
  
Also, add a new utility, camdd(8) that uses the asynchronous pass(4)
driver interface.
  
This utility is intended to be a basic data transfer/copy utility,
a simple benchmark utility, and an example of how to use the
asynchronous pass(4) interface.
  
It can copy data to and from pass(4) devices using any target queue
depth, starting offset and blocksize for the input and ouptut devices.
It currently only supports SCSI devices, but could be easily extended
to support ATA devices.
  
It can also copy data to and from regular files, block devices, tape
devices, pipes, stdin, and stdout.  It does not support queueing
multiple commands to any of those targets, since it uses the standard
read(2)/write(2)/writev(2)/readv(2) system calls.
  
The I/O is done by two threads, one for the reader and one for the
writer.  The reader thread sends completed read requests to the
writer thread in strictly sequential order, even if they complete
out of order.  That could be modified later on for random I/O patterns
or slightly out of order I/O.
  
camdd(8) uses kqueue(2)/kevent(2) to get I/O completion events from
the pass(4) driver and also to send request notifications internally.
  
For pass(4) devcies, camdd(8) uses a single buffer (CAM_DATA_VADDR)
per CAM CCB on the reading side, and a scatter/gather list
(CAM_DATA_SG) on the writing side.  In addition to testing both
interfaces, this makes any potential reblocking of I/O easier.  No
data is copied between the reader and the writer, but rather the
reader's buffers are split into multiple I/O requests or combined
into a single I/O request depending 

Re: svn commit: r291716 - in head: share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/dev/md sys/geom sys/kern sys/pc98/include sys/sys usr.sbin usr.sbin/camdd

2016-01-11 Thread Kenneth D. Merry
On Mon, Jan 11, 2016 at 18:29:22 +0100, Roger Pau Monn?? wrote:
> El 03/12/15 a les 21.54, Kenneth D. Merry ha escrit:
> > Author: ken
> > Date: Thu Dec  3 20:54:55 2015
> > New Revision: 291716
> > URL: https://svnweb.freebsd.org/changeset/base/291716
> > 
> > Log:
> >   Add asynchronous command support to the pass(4) driver, and the new
> >   camdd(8) utility.
> >   
> >   CCBs may be queued to the driver via the new CAMIOQUEUE ioctl, and
> >   completed CCBs may be retrieved via the CAMIOGET ioctl.  User
> >   processes can use poll(2) or kevent(2) to get notification when
> >   I/O has completed.
> >   
> >   While the existing CAMIOCOMMAND blocking ioctl interface only
> >   supports user virtual data pointers in a CCB (generally only
> >   one per CCB), the new CAMIOQUEUE ioctl supports user virtual and
> >   physical address pointers, as well as user virtual and physical
> >   scatter/gather lists.  This allows user applications to have more
> >   flexibility in their data handling operations.
> >   
> >   Kernel memory for data transferred via the queued interface is
> >   allocated from the zone allocator in MAXPHYS sized chunks, and user
> >   data is copied in and out.  This is likely faster than the
> >   vmapbuf()/vunmapbuf() method used by the CAMIOCOMMAND ioctl in
> >   configurations with many processors (there are more TLB shootdowns
> >   caused by the mapping/unmapping operation) but may not be as fast
> >   as running with unmapped I/O.
> >   
> >   The new memory handling model for user requests also allows
> >   applications to send CCBs with request sizes that are larger than
> >   MAXPHYS.  The pass(4) driver now limits queued requests to the I/O
> >   size listed by the SIM driver in the maxio field in the Path
> >   Inquiry (XPT_PATH_INQ) CCB.
> >   
> >   There are some things things would be good to add:
> >   
> >   1. Come up with a way to do unmapped I/O on multiple buffers.
> >  Currently the unmapped I/O interface operates on a struct bio,
> >  which includes only one address and length.  It would be nice
> >  to be able to send an unmapped scatter/gather list down to
> >  busdma.  This would allow eliminating the copy we currently do
> >  for data.
> >   
> >   2. Add an ioctl to list currently outstanding CCBs in the various
> >  queues.
> >   
> >   3. Add an ioctl to cancel a request, or use the XPT_ABORT CCB to do
> >  that.
> >   
> >   4. Test physical address support.  Virtual pointers and scatter
> >  gather lists have been tested, but I have not yet tested
> >  physical addresses or scatter/gather lists.
> >   
> >   5. Investigate multiple queue support.  At the moment there is one
> >  queue of commands per pass(4) device.  If multiple processes
> >  open the device, they will submit I/O into the same queue and
> >  get events for the same completions.  This is probably the right
> >  model for most applications, but it is something that could be
> >  changed later on.
> >   
> >   Also, add a new utility, camdd(8) that uses the asynchronous pass(4)
> >   driver interface.
> >   
> >   This utility is intended to be a basic data transfer/copy utility,
> >   a simple benchmark utility, and an example of how to use the
> >   asynchronous pass(4) interface.
> >   
> >   It can copy data to and from pass(4) devices using any target queue
> >   depth, starting offset and blocksize for the input and ouptut devices.
> >   It currently only supports SCSI devices, but could be easily extended
> >   to support ATA devices.
> >   
> >   It can also copy data to and from regular files, block devices, tape
> >   devices, pipes, stdin, and stdout.  It does not support queueing
> >   multiple commands to any of those targets, since it uses the standard
> >   read(2)/write(2)/writev(2)/readv(2) system calls.
> >   
> >   The I/O is done by two threads, one for the reader and one for the
> >   writer.  The reader thread sends completed read requests to the
> >   writer thread in strictly sequential order, even if they complete
> >   out of order.  That could be modified later on for random I/O patterns
> >   or slightly out of order I/O.
> >   
> >   camdd(8) uses kqueue(2)/kevent(2) to get I/O completion events from
> >   the pass(4) driver and also to send request notifications internally.
> >   
> >   For pass(4) devcies, camdd(8) uses a single buffer (CAM_DATA_VADDR)
> >   per CAM CCB on the

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 = &done_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 = &done_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 = &done_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 = &done_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 = &done_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 = &done_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_entrie

svn commit: r309374 - in head: sbin/camcontrol sys/cam/scsi

2016-12-01 Thread Kenneth D. Merry
Author: ken
Date: Thu Dec  1 22:20:27 2016
New Revision: 309374
URL: https://svnweb.freebsd.org/changeset/base/309374

Log:
  Add SCSI REPORT TIMESTAMP and SET TIMESTAMP support.
  
  This adds support to camcontrol(8) and libcam(3) for getting and setting
  the time on SCSI protocol drives.  This is more commonly found on tape
  drives, but is a SPC (SCSI Primary Commands) command, and may be found
  on any device that speaks SCSI.
  
  The new camcontrol timestamp subcommand allows getting the current device
  time or setting the time to the current system time or any arbitrary time.
  
  sbin/camcontrol/Makefile:
Add timestamp.c.
  
  sbin/camcontrol/camcontrol.8:
Document the new timestamp subcommand.
  
  sbin/camcontrol/camcontrol.c:
Add the timestamp subcommand to camcontrol.
  
  sbin/camcontrol/camcontrol.h:
Add the timestamp() function prototype.
  
  sbin/camcontrol/timestamp.c:
Timestamp setting and reporting functionality.
  
  sys/cam/scsi/scsi_all.c:
Add two new CCB building functions, scsi_set_timestamp() and
scsi_report_timestamp().  Also, add a new helper function,
scsi_create_timestamp().
  
  sys/cam/scsi/scsi_all.h:
Add CDB and parameter data for the the set and report timestamp
commands.
  
Add function declarations for the new CCB building and helper
functions.
  
  Submitted by: Sam Klopsch
  Sponsored by: Spectra Logic
  MFC After:2 weeks

Added:
  head/sbin/camcontrol/timestamp.c   (contents, props changed)
Modified:
  head/sbin/camcontrol/Makefile
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c
  head/sbin/camcontrol/camcontrol.h
  head/sys/cam/scsi/scsi_all.c
  head/sys/cam/scsi/scsi_all.h

Modified: head/sbin/camcontrol/Makefile
==
--- head/sbin/camcontrol/Makefile   Thu Dec  1 22:12:58 2016
(r309373)
+++ head/sbin/camcontrol/Makefile   Thu Dec  1 22:20:27 2016
(r309374)
@@ -4,7 +4,7 @@ PACKAGE=runtime
 PROG=  camcontrol
 SRCS=  camcontrol.c util.c
 .if !defined(RELEASE_CRUNCH)
-SRCS+= attrib.c epc.c fwdownload.c modeedit.c persist.c progress.c zone.c
+SRCS+= attrib.c epc.c fwdownload.c modeedit.c persist.c progress.c timestamp.c 
zone.c
 .else
 CFLAGS+= -DMINIMALISTIC
 .endif

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Thu Dec  1 22:12:58 2016
(r309373)
+++ head/sbin/camcontrol/camcontrol.8   Thu Dec  1 22:20:27 2016
(r309374)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 16, 2016
+.Dd November 30, 2016
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -343,6 +343,11 @@
 .Op Fl S Ar power_src
 .Op Fl T Ar timer
 .Nm
+.Ic timestamp
+.Op device id
+.Op generic args
+.Ao Fl r Oo Ns Fl f Ar format | Fl m | Fl U Oc | Fl s Ao Fl f Ar format Fl T 
Ar time | Fl U Ac Ac
+.Nm
 .Ic help
 .Sh DESCRIPTION
 The
@@ -2417,6 +2422,54 @@ supports, and a number of parameters abo
 whether it is enabled and what the timer value is.
 .El
 .El
+.It Ic timestamp
+Issue REPORT TIMESTAMP or SET TIMESTAMP
+.Tn SCSI
+commands. Either the
+.Fl r
+option or the
+.Fl s
+option must be specified.
+.Bl -tag -width 6n
+.It Fl r
+Report the device's timestamp.
+If no more arguments are specified, the timestamp will be reported using
+the national representation of the date and time, followed by the time
+zone.
+.Bl -tag -width 9n
+.It Fl f Ar format
+Specify the strftime format string, as documented in strftime(3), to be used
+to format the reported timestamp.
+.It Fl m
+Report the timestamp as milliseconds since the epoch.
+.It Fl U
+Report the timestamp using the national representation of the date and
+time, but override the system time zone and use UTC instead.
+.El
+.El
+.Bl -tag -width 6n
+.It Fl s
+Set the device's timestamp. Either the
+.Fl f
+and 
+.Fl T
+options or the
+.Fl U
+option must be specified.
+.Bl -tag -width 9n
+.It Fl f Ar format
+Specify the strptime format string, as documented in strptime(3).
+The time must also be specified with the
+.Fl T 
+option.
+.It Fl T
+Provide the time in the format specified with the
+.Fl f
+option.
+.It Fl U
+Set the timestamp to the host system's time in UTC.
+.El
+.El
 .It Ic help
 Print out verbose usage information.
 .El
@@ -2730,6 +2783,18 @@ camcontrol epc ada0 -c list
 Display the ATA Power Conditions log (Log Address 0x08) for
 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"
+.Ed
+.Pp
+Set the timestamp of drive
+.Pa sa0
+using a
+.Xr strptime 3 
+format string followed by a time string
+that was created using this format string.
 .Sh SEE ALSO
 .Xr cam 3 ,
 .Xr cam_cdbparse 3 ,

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin

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: 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: 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, &un.bill);
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, &un.fred);
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->h

<    1   2   3   4   5   >