Print this page
NEX-5733 cleanup qlt/qlc
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
NEX-5717 import QLogic 16G FC drivers
Reviewed by: Steve Peng <steve.peng@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.c
          +++ new/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23      - * Copyright 2009 QLogic Corporation.  All rights reserved.
       23 + * Copyright 2009-2015 QLogic Corporation.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  /*
  28      - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
       28 + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  29   29   */
  30   30  
  31   31  #include <sys/conf.h>
  32   32  #include <sys/ddi.h>
  33   33  #include <sys/sunddi.h>
  34   34  #include <sys/modctl.h>
  35   35  
  36   36  #include <sys/stmf_defines.h>
  37   37  #include <sys/fct_defines.h>
  38   38  #include <sys/stmf.h>
↓ open down ↓ 168 lines elided ↑ open up ↑
 207  207  alloc_handle_failed:;
 208  208          kmem_free(p->dmem_bctls_mem, p->dmem_nbufs * sizeof (qlt_dmem_bctl_t));
 209  209          mutex_destroy(&p->dmem_lock);
 210  210  alloc_bctl_failed:;
 211  211          if (--ndx >= 0) {
 212  212                  p = qlt->dmem_buckets[ndx];
 213  213                  bctl = p->dmem_bctl_free_list;
 214  214                  goto dmem_failure_loop;
 215  215          }
 216  216          kmem_free(qlt->dmem_buckets, sizeof (dmem_buckets) +
 217      -            ((sizeof (dmem_buckets)/sizeof (void *))
 218      -            *sizeof (qlt_dmem_bucket_t)));
      217 +            (((sizeof (dmem_buckets)/sizeof (void *))-1)*
      218 +            sizeof (qlt_dmem_bucket_t)));
 219  219          qlt->dmem_buckets = NULL;
 220  220  
 221  221          return (QLT_FAILURE);
 222  222  }
 223  223  
 224  224  void
 225  225  qlt_dma_handle_pool_init(qlt_state_t *qlt)
 226  226  {
 227  227          qlt_dma_handle_pool_t *pool;
 228  228  
↓ open down ↓ 327 lines elided ↑ open up ↑
 556  556          handle_count = 0;
 557  557          while (tmp_handle != NULL) {
 558  558                  last_handle = tmp_handle;
 559  559                  /*
 560  560                   * If the handle is bound, unbind the handle so it can be
 561  561                   * reused. It may not be bound if there was a bind failure.
 562  562                   */
 563  563                  if (tmp_handle->num_cookies != 0) {
 564  564                          rv = ddi_dma_unbind_handle(tmp_handle->dma_handle);
 565  565                          ASSERT(rv == DDI_SUCCESS);
 566      -                        tmp_handle->num_cookies = 0;
 567      -                        tmp_handle->num_cookies_fetched = 0;
      566 +                        if (rv == DDI_SUCCESS) {
      567 +                                tmp_handle->num_cookies = 0;
      568 +                                tmp_handle->num_cookies_fetched = 0;
      569 +                        }
 568  570                  }
 569  571                  tmp_handle = tmp_handle->next;
 570  572                  handle_count++;
 571  573          }
 572  574          /*
 573  575           * Insert this list into the free list
 574  576           */
 575  577          pool = qlt->qlt_dma_handle_pool;
 576  578          mutex_enter(&pool->pool_lock);
 577  579          last_handle->next = pool->free_list;
↓ open down ↓ 61 lines elided ↑ open up ↑
 639  641                  }
 640  642          }
 641  643  }
 642  644  
 643  645  /*
 644  646   * Set this flag to fetch the DDI dma cookies from the handles here and
 645  647   * store them in the port private area of the dbuf. This will allow
 646  648   * faster access to the cookies in qlt_xfer_scsi_data() at the expense of
 647  649   * an extra copy. If the qlt->req_lock is hot, this may help.
 648  650   */
 649      -int qlt_sgl_prefetch = 0;
      651 +uint16_t qlt_sgl_prefetch = 0;
 650  652  
 651  653  /*ARGSUSED*/
 652  654  stmf_status_t
 653  655  qlt_dma_setup_dbuf(fct_local_port_t *port, stmf_data_buf_t *dbuf,
 654  656      uint32_t flags)
 655  657  {
 656  658          qlt_state_t             *qlt = port->port_fca_private;
 657  659          qlt_dma_sgl_t           *qsgl;
 658  660          struct stmf_sglist_ent  *sglp;
 659  661          qlt_dma_handle_t        *handle_list, *th;
 660  662          int                     i, rv;
 661  663          ddi_dma_cookie_t        *cookie_p;
 662      -        int                     cookie_count, numbufs;
 663      -        int                     prefetch;
      664 +        int                     numbufs;
      665 +        uint16_t                cookie_count;
      666 +        uint16_t                prefetch;
 664  667          size_t                  qsize;
 665  668  
 666  669          /*
 667  670           * psuedo code:
 668  671           * get dma handle list from cache - one per sglist entry
 669  672           * foreach sglist entry
 670  673           *      bind dma handle to sglist vaddr
 671  674           * allocate space for DMA state to store in db_port_private
 672  675           * fill in port private object
 673  676           * if prefetching
↓ open down ↓ 131 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX