lpfc 8.3.11: SLI4 Improvements
Subsystems (2)
PATCH 2/6 lpfc 8.3.11: SLI4 Improvements
SLI4 Improvements
- Correct all SLI4 code to work on big endian systems.
- Move read of sli4 params earlier so returned values are used correctly.
Signed-off-by Alex Iannicelli <[email protected]>
Signed-off-by James Smart <[email protected]>
---
lpfc_hbadisc.c | 4 ++- lpfc_hw4.h | 7 +++++ lpfc_init.c | 76 ++++++++++++++++++++++++++++----------------------------- lpfc_sli.c | 37 +++++++++++++++------------ 4 files changed, 69 insertions(+), 55 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +3 -1
@@ -1621,7 +1621,9 @@ lpfc_sli4_fcf_rec_mbox_parse(struct lpfc new_fcf_record = (struct fcf_record *)(virt_addr +sizeof (struct lpfc_mbx_read_fcf_tbl ));lpfc_sli_pcimem_bcopy (new_fcf_record, new_fcf_record, -sizeof (struct fcf_record )); + offsetof(struct fcf_record , vlan_bitmap)); + new_fcf_record->word137 =le32_to_cpu (new_fcf_record->word137); + new_fcf_record->word138 =le32_to_cpu (new_fcf_record->word138);return new_fcf_record; }
drivers/scsi/lpfc/lpfc_hw4.h +7 -0
@@ -41,8 +41,14 @@* Or clear that bit field: * bf_set(example_bit_field, &t1, 0); */ +#define bf_get_le32 (name, ptr) \ + ((le32_to_cpu((ptr)->name##_WORD) >> name##_SHIFT) & name##_MASK)#define bf_get (name, ptr) \ (((ptr)->name##_WORD >> name##_SHIFT) & name##_MASK) +#define bf_set_le32 (name, ptr, value) \ + ((ptr)->name##_WORD = cpu_to_le32(((((value) & \ + name##_MASK) << name##_SHIFT) | (le32_to_cpu((ptr)->name##_WORD) & \ + ~(name##_MASK << name##_SHIFT)))))#define bf_set (name, ptr, value) \ ((ptr)->name##_WORD = ((((value) & name##_MASK) << name##_SHIFT) | \ ((ptr)->name##_WORD & ~(name##_MASK << name##_SHIFT))))
@@ -1940,6 +1946,7 @@ struct lpfc_mbx_sli4_params {#define rdma_MASK 0x00000001#define rdma_WORD word3uint32_t sge_supp_len; +#define SLI4_PAGE_SIZE 4096uint32_t word5;#define if_page_sz_SHIFT 0#define if_page_sz_MASK 0x0000ffff
drivers/scsi/lpfc/lpfc_init.c +38 -38
94 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli.c +21 -16
@@ -211,7 +211,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)
@@ -246,7 +246,7 @@ lpfc_sli4_eq_release(struct lpfc_queue */* 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); }
@@ -284,7 +284,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)
@@ -320,7 +320,7 @@ lpfc_sli4_cq_release(struct lpfc_queue */* 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); }
@@ -8982,17 +8982,17 @@ lpfc_sli4_sp_handle_eqe(struct lpfc_hbaint 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;
@@ -9220,12 +9220,12 @@ lpfc_sli4_fp_handle_eqe(struct lpfc_hbauint16_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 ; }
@@ -9238,7 +9238,7 @@ lpfc_sli4_fp_handle_eqe(struct lpfc_hba }/* 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 "
@@ -9531,13 +9531,18 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *pstruct 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);
@@ -9546,19 +9551,19 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *pif (!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; }