Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Allow adapters with SAS/SATA or FC devices to use...



details:   https://anonhg.NetBSD.org/src/rev/0424b7327fc7
branches:  trunk
changeset: 773296:0424b7327fc7
user:      mhitch <mhitch%NetBSD.org@localhost>
date:      Mon Jan 30 17:45:14 2012 +0000

description:
Allow adapters with SAS/SATA or FC devices to use tagged queuing by the scsipi
layer.  Can improve write performance on SAS adapters under certain conditions
when the logical drive does not have write caching enabled.  Also need to
reserver a couple of slots for commands for the driver to use - stops the
adapter shortage messages.  Multiple commands can now cause QUEUE_FULL events,
so add that to the events handled, currently just ignoring it.  Changes
based on the thread http://mail-index.netbsd.org/tech-kern/2011/02/08/msg009946.html.
cvs: ----------------------------------------------------------------------

diffstat:

 sys/dev/ic/mpt_netbsd.c |  131 ++++++++++++++++++++++++-----------------------
 1 files changed, 68 insertions(+), 63 deletions(-)

diffs (180 lines):

diff -r 3f8e629e0f48 -r 0424b7327fc7 sys/dev/ic/mpt_netbsd.c
--- a/sys/dev/ic/mpt_netbsd.c   Mon Jan 30 17:35:18 2012 +0000
+++ b/sys/dev/ic/mpt_netbsd.c   Mon Jan 30 17:45:14 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpt_netbsd.c,v 1.16 2011/07/17 20:54:51 joerg Exp $    */
+/*     $NetBSD: mpt_netbsd.c,v 1.17 2012/01/30 17:45:14 mhitch Exp $   */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.16 2011/07/17 20:54:51 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.17 2012/01/30 17:45:14 mhitch Exp $");
 
 #include <dev/ic/mpt.h>                        /* pulls in all headers */
 
@@ -110,8 +110,8 @@
        memset(adapt, 0, sizeof(*adapt));
        adapt->adapt_dev = &mpt->sc_dev;
        adapt->adapt_nchannels = 1;
-       adapt->adapt_openings = maxq;
-       adapt->adapt_max_periph = maxq;
+       adapt->adapt_openings = maxq - 2;       /* Reserve 2 for driver use*/
+       adapt->adapt_max_periph = maxq - 2;
        adapt->adapt_request = mpt_scsipi_request;
        adapt->adapt_minphys = mpt_minphys;
 
@@ -937,14 +937,6 @@
 {
        fCONFIG_PAGE_SCSI_DEVICE_1 tmp;
 
-       if (!mpt->is_scsi) {
-               /*
-                * SCSI transport settings don't make any sense for
-                * Fibre Channel; silently ignore the request.
-                */
-               return;
-       }
-
        /*
         * Always allow disconnect; we don't have a way to disable
         * it right now, in any case.
@@ -956,64 +948,71 @@
        else
                mpt->mpt_tag_enable &= ~(1 << xm->xm_target);
 
-       tmp = mpt->mpt_dev_page1[xm->xm_target];
+       if (mpt->is_scsi) {
+               /*
+                * SCSI transport settings only make any sense for
+                * SCSI
+                */
 
-       /*
-        * Set the wide/narrow parameter for the target.
-        */
-       if (xm->xm_mode & PERIPH_CAP_WIDE16)
-               tmp.RequestedParameters |= MPI_SCSIDEVPAGE1_RP_WIDE;
-       else
-               tmp.RequestedParameters &= ~MPI_SCSIDEVPAGE1_RP_WIDE;
+               tmp = mpt->mpt_dev_page1[xm->xm_target];
 
-       /*
-        * Set the synchronous parameters for the target.
-        *
-        * XXX If we request sync transfers, we just go ahead and
-        * XXX request the maximum available.  We need finer control
-        * XXX in order to implement Domain Validation.
-        */
-       tmp.RequestedParameters &= ~(MPI_SCSIDEVPAGE1_RP_MIN_SYNC_PERIOD_MASK |
-           MPI_SCSIDEVPAGE1_RP_MAX_SYNC_OFFSET_MASK |
-           MPI_SCSIDEVPAGE1_RP_DT | MPI_SCSIDEVPAGE1_RP_QAS |
-           MPI_SCSIDEVPAGE1_RP_IU);
-       if (xm->xm_mode & PERIPH_CAP_SYNC) {
-               int factor, offset, np;
+               /*
+                * Set the wide/narrow parameter for the target.
+                */
+               if (xm->xm_mode & PERIPH_CAP_WIDE16)
+                       tmp.RequestedParameters |= MPI_SCSIDEVPAGE1_RP_WIDE;
+               else
+                       tmp.RequestedParameters &= ~MPI_SCSIDEVPAGE1_RP_WIDE;
+
+               /*
+                * Set the synchronous parameters for the target.
+                *
+                * XXX If we request sync transfers, we just go ahead and
+                * XXX request the maximum available.  We need finer control
+                * XXX in order to implement Domain Validation.
+                */
+               tmp.RequestedParameters &= ~(MPI_SCSIDEVPAGE1_RP_MIN_SYNC_PERIOD_MASK |
+                   MPI_SCSIDEVPAGE1_RP_MAX_SYNC_OFFSET_MASK |
+                   MPI_SCSIDEVPAGE1_RP_DT | MPI_SCSIDEVPAGE1_RP_QAS |
+                   MPI_SCSIDEVPAGE1_RP_IU);
+               if (xm->xm_mode & PERIPH_CAP_SYNC) {
+                       int factor, offset, np;
 
-               factor = (mpt->mpt_port_page0.Capabilities >> 8) & 0xff;
-               offset = (mpt->mpt_port_page0.Capabilities >> 16) & 0xff;
-               np = 0;
-               if (factor < 0x9) {
-                       /* Ultra320 */
-                       np |= MPI_SCSIDEVPAGE1_RP_QAS | MPI_SCSIDEVPAGE1_RP_IU;
+                       factor = (mpt->mpt_port_page0.Capabilities >> 8) & 0xff;
+                       offset = (mpt->mpt_port_page0.Capabilities >> 16) & 0xff;
+                       np = 0;
+                       if (factor < 0x9) {
+                               /* Ultra320 */
+                               np |= MPI_SCSIDEVPAGE1_RP_QAS | MPI_SCSIDEVPAGE1_RP_IU;
+                       }
+                       if (factor < 0xa) {
+                               /* at least Ultra160 */
+                               np |= MPI_SCSIDEVPAGE1_RP_DT;
+                       }
+                       np |= (factor << 8) | (offset << 16);
+                       tmp.RequestedParameters |= np;
                }
-               if (factor < 0xa) {
-                       /* at least Ultra160 */
-                       np |= MPI_SCSIDEVPAGE1_RP_DT;
-               }
-               np |= (factor << 8) | (offset << 16);
-               tmp.RequestedParameters |= np;
-       }
 
-       host2mpt_config_page_scsi_device_1(&tmp);
-       if (mpt_write_cfg_page(mpt, xm->xm_target, &tmp.Header)) {
-               mpt_prt(mpt, "unable to write Device Page 1");
-               return;
-       }
+               host2mpt_config_page_scsi_device_1(&tmp);
+               if (mpt_write_cfg_page(mpt, xm->xm_target, &tmp.Header)) {
+                       mpt_prt(mpt, "unable to write Device Page 1");
+                       return;
+               }
 
-       if (mpt_read_cfg_page(mpt, xm->xm_target, &tmp.Header)) {
-               mpt_prt(mpt, "unable to read back Device Page 1");
-               return;
-       }
+               if (mpt_read_cfg_page(mpt, xm->xm_target, &tmp.Header)) {
+                       mpt_prt(mpt, "unable to read back Device Page 1");
+                       return;
+               }
 
-       mpt2host_config_page_scsi_device_1(&tmp);
-       mpt->mpt_dev_page1[xm->xm_target] = tmp;
-       if (mpt->verbose > 1) {
-               mpt_prt(mpt,
-                   "SPI Target %d Page 1: RequestedParameters %x Config %x",
-                   xm->xm_target,
-                   mpt->mpt_dev_page1[xm->xm_target].RequestedParameters,
-                   mpt->mpt_dev_page1[xm->xm_target].Configuration);
+               mpt2host_config_page_scsi_device_1(&tmp);
+               mpt->mpt_dev_page1[xm->xm_target] = tmp;
+               if (mpt->verbose > 1) {
+                       mpt_prt(mpt,
+                           "SPI Target %d Page 1: RequestedParameters %x Config %x",
+                           xm->xm_target,
+                           mpt->mpt_dev_page1[xm->xm_target].RequestedParameters,
+                           mpt->mpt_dev_page1[xm->xm_target].Configuration);
+               }
        }
 
        /*
@@ -1296,6 +1295,12 @@
                /* ignore these events for now */
                break;
 
+       case MPI_EVENT_QUEUE_FULL:
+               /* This can get a little chatty */
+               if (mpt->verbose > 0)
+                       mpt_prt(mpt, "Queue Full Event");
+               break;
+
        default:
                mpt_prt(mpt, "Unknown async event: 0x%x", msg->Event);
                break;



Home | Main Index | Thread Index | Old Index