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>
        
@@ -18,16 +18,16 @@
  *
  * CDDL HEADER END
  */
 
 /*
- * Copyright 2009 QLogic Corporation.  All rights reserved.
+ * Copyright 2009-2015 QLogic Corporation.  All rights reserved.
  * Use is subject to license terms.
  */
 
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  */
 
 #include <sys/conf.h>
 #include <sys/ddi.h>
 #include <sys/sunddi.h>
@@ -212,12 +212,12 @@
                 p = qlt->dmem_buckets[ndx];
                 bctl = p->dmem_bctl_free_list;
                 goto dmem_failure_loop;
         }
         kmem_free(qlt->dmem_buckets, sizeof (dmem_buckets) +
-            ((sizeof (dmem_buckets)/sizeof (void *))
-            *sizeof (qlt_dmem_bucket_t)));
+            (((sizeof (dmem_buckets)/sizeof (void *))-1)*
+            sizeof (qlt_dmem_bucket_t)));
         qlt->dmem_buckets = NULL;
 
         return (QLT_FAILURE);
 }
 
@@ -561,13 +561,15 @@
                  * reused. It may not be bound if there was a bind failure.
                  */
                 if (tmp_handle->num_cookies != 0) {
                         rv = ddi_dma_unbind_handle(tmp_handle->dma_handle);
                         ASSERT(rv == DDI_SUCCESS);
+                        if (rv == DDI_SUCCESS) {
                         tmp_handle->num_cookies = 0;
                         tmp_handle->num_cookies_fetched = 0;
                 }
+                }
                 tmp_handle = tmp_handle->next;
                 handle_count++;
         }
         /*
          * Insert this list into the free list
@@ -644,11 +646,11 @@
  * Set this flag to fetch the DDI dma cookies from the handles here and
  * store them in the port private area of the dbuf. This will allow
  * faster access to the cookies in qlt_xfer_scsi_data() at the expense of
  * an extra copy. If the qlt->req_lock is hot, this may help.
  */
-int qlt_sgl_prefetch = 0;
+uint16_t qlt_sgl_prefetch = 0;
 
 /*ARGSUSED*/
 stmf_status_t
 qlt_dma_setup_dbuf(fct_local_port_t *port, stmf_data_buf_t *dbuf,
     uint32_t flags)
@@ -657,12 +659,13 @@
         qlt_dma_sgl_t           *qsgl;
         struct stmf_sglist_ent  *sglp;
         qlt_dma_handle_t        *handle_list, *th;
         int                     i, rv;
         ddi_dma_cookie_t        *cookie_p;
-        int                     cookie_count, numbufs;
-        int                     prefetch;
+        int                     numbufs;
+        uint16_t                cookie_count;
+        uint16_t                prefetch;
         size_t                  qsize;
 
         /*
          * psuedo code:
          * get dma handle list from cache - one per sglist entry