[SCSI] lpfc 8.3.11: SLI4 Improvements
[deliverable/linux.git] / drivers / scsi / lpfc / lpfc_sli.c
index 2eff81d366f970fbfab58decdd1eb3485057b245..dd879a7d04a31538ec5177616c3af6103b32e9d6 100644 (file)
@@ -212,7 +212,7 @@ lpfc_sli4_eq_get(struct lpfc_queue *q)
        struct lpfc_eqe *eqe = q->qe[q->hba_index].eqe;
 
        /* If the next EQE is not valid then we are done */
-       if (!bf_get(lpfc_eqe_valid, eqe))
+       if (!bf_get_le32(lpfc_eqe_valid, eqe))
                return NULL;
        /* If the host has not yet processed the next entry then we are done */
        if (((q->hba_index + 1) % q->entry_count) == q->host_index)
@@ -247,7 +247,7 @@ lpfc_sli4_eq_release(struct lpfc_queue *q, bool arm)
        /* while there are valid entries */
        while (q->hba_index != q->host_index) {
                temp_eqe = q->qe[q->host_index].eqe;
-               bf_set(lpfc_eqe_valid, temp_eqe, 0);
+               bf_set_le32(lpfc_eqe_valid, temp_eqe, 0);
                released++;
                q->host_index = ((q->host_index + 1) % q->entry_count);
        }
@@ -285,7 +285,7 @@ lpfc_sli4_cq_get(struct lpfc_queue *q)
        struct lpfc_cqe *cqe;
 
        /* If the next CQE is not valid then we are done */
-       if (!bf_get(lpfc_cqe_valid, q->qe[q->hba_index].cqe))
+       if (!bf_get_le32(lpfc_cqe_valid, q->qe[q->hba_index].cqe))
                return NULL;
        /* If the host has not yet processed the next entry then we are done */
        if (((q->hba_index + 1) % q->entry_count) == q->host_index)
@@ -321,7 +321,7 @@ lpfc_sli4_cq_release(struct lpfc_queue *q, bool arm)
        /* while there are valid entries */
        while (q->hba_index != q->host_index) {
                temp_qe = q->qe[q->host_index].cqe;
-               bf_set(lpfc_cqe_valid, temp_qe, 0);
+               bf_set_le32(lpfc_cqe_valid, temp_qe, 0);
                released++;
                q->host_index = ((q->host_index + 1) % q->entry_count);
        }
@@ -8983,17 +8983,17 @@ lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe)
        int ecount = 0;
        uint16_t cqid;
 
-       if (bf_get(lpfc_eqe_major_code, eqe) != 0) {
+       if (bf_get_le32(lpfc_eqe_major_code, eqe) != 0) {
                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
                                "0359 Not a valid slow-path completion "
                                "event: majorcode=x%x, minorcode=x%x\n",
-                               bf_get(lpfc_eqe_major_code, eqe),
-                               bf_get(lpfc_eqe_minor_code, eqe));
+                               bf_get_le32(lpfc_eqe_major_code, eqe),
+                               bf_get_le32(lpfc_eqe_minor_code, eqe));
                return;
        }
 
        /* Get the reference to the corresponding CQ */
-       cqid = bf_get(lpfc_eqe_resource_id, eqe);
+       cqid = bf_get_le32(lpfc_eqe_resource_id, eqe);
 
        /* Search for completion queue pointer matching this cqid */
        speq = phba->sli4_hba.sp_eq;
@@ -9221,12 +9221,12 @@ lpfc_sli4_fp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
        uint16_t cqid;
        int ecount = 0;
 
-       if (unlikely(bf_get(lpfc_eqe_major_code, eqe) != 0)) {
+       if (unlikely(bf_get_le32(lpfc_eqe_major_code, eqe) != 0)) {
                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
                                "0366 Not a valid fast-path completion "
                                "event: majorcode=x%x, minorcode=x%x\n",
-                               bf_get(lpfc_eqe_major_code, eqe),
-                               bf_get(lpfc_eqe_minor_code, eqe));
+                               bf_get_le32(lpfc_eqe_major_code, eqe),
+                               bf_get_le32(lpfc_eqe_minor_code, eqe));
                return;
        }
 
@@ -9239,7 +9239,7 @@ lpfc_sli4_fp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
        }
 
        /* Get the reference to the corresponding CQ */
-       cqid = bf_get(lpfc_eqe_resource_id, eqe);
+       cqid = bf_get_le32(lpfc_eqe_resource_id, eqe);
        if (unlikely(cqid != cq->queue_id)) {
                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
                                "0368 Miss-matched fast-path completion "
@@ -9532,13 +9532,18 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32_t entry_size,
        struct lpfc_dmabuf *dmabuf;
        int x, total_qe_count;
        void *dma_pointer;
+       uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz;
 
 
+       if (!phba->sli4_hba.pc_sli4_params.supported)
+               hw_page_size = SLI4_PAGE_SIZE;
+
        queue = kzalloc(sizeof(struct lpfc_queue) +
                        (sizeof(union sli4_qe) * entry_count), GFP_KERNEL);
        if (!queue)
                return NULL;
-       queue->page_count = (PAGE_ALIGN(entry_size * entry_count))/PAGE_SIZE;
+       queue->page_count = (ALIGN(entry_size * entry_count,
+                       hw_page_size))/hw_page_size;
        INIT_LIST_HEAD(&queue->list);
        INIT_LIST_HEAD(&queue->page_list);
        INIT_LIST_HEAD(&queue->child_list);
@@ -9547,19 +9552,19 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32_t entry_size,
                if (!dmabuf)
                        goto out_fail;
                dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
-                                                 PAGE_SIZE, &dmabuf->phys,
+                                                 hw_page_size, &dmabuf->phys,
                                                  GFP_KERNEL);
                if (!dmabuf->virt) {
                        kfree(dmabuf);
                        goto out_fail;
                }
-               memset(dmabuf->virt, 0, PAGE_SIZE);
+               memset(dmabuf->virt, 0, hw_page_size);
                dmabuf->buffer_tag = x;
                list_add_tail(&dmabuf->list, &queue->page_list);
                /* initialize queue's entry array */
                dma_pointer = dmabuf->virt;
                for (; total_qe_count < entry_count &&
-                    dma_pointer < (PAGE_SIZE + dmabuf->virt);
+                    dma_pointer < (hw_page_size + dmabuf->virt);
                     total_qe_count++, dma_pointer += entry_size) {
                        queue->qe[total_qe_count].address = dma_pointer;
                }
This page took 0.069284 seconds and 5 git commands to generate.