diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 228 |
1 files changed, 148 insertions, 80 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 2ee0374a9908..84234a4c54ce 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -10403,7 +10403,6 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq, | |||
10403 | if (!phba->sli4_hba.pc_sli4_params.supported) | 10403 | if (!phba->sli4_hba.pc_sli4_params.supported) |
10404 | hw_page_size = SLI4_PAGE_SIZE; | 10404 | hw_page_size = SLI4_PAGE_SIZE; |
10405 | 10405 | ||
10406 | |||
10407 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 10406 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
10408 | if (!mbox) | 10407 | if (!mbox) |
10409 | return -ENOMEM; | 10408 | return -ENOMEM; |
@@ -10413,11 +10412,22 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq, | |||
10413 | LPFC_MBOX_OPCODE_CQ_CREATE, | 10412 | LPFC_MBOX_OPCODE_CQ_CREATE, |
10414 | length, LPFC_SLI4_MBX_EMBED); | 10413 | length, LPFC_SLI4_MBX_EMBED); |
10415 | cq_create = &mbox->u.mqe.un.cq_create; | 10414 | cq_create = &mbox->u.mqe.un.cq_create; |
10415 | shdr = (union lpfc_sli4_cfg_shdr *) &cq_create->header.cfg_shdr; | ||
10416 | bf_set(lpfc_mbx_cq_create_num_pages, &cq_create->u.request, | 10416 | bf_set(lpfc_mbx_cq_create_num_pages, &cq_create->u.request, |
10417 | cq->page_count); | 10417 | cq->page_count); |
10418 | bf_set(lpfc_cq_context_event, &cq_create->u.request.context, 1); | 10418 | bf_set(lpfc_cq_context_event, &cq_create->u.request.context, 1); |
10419 | bf_set(lpfc_cq_context_valid, &cq_create->u.request.context, 1); | 10419 | bf_set(lpfc_cq_context_valid, &cq_create->u.request.context, 1); |
10420 | bf_set(lpfc_cq_eq_id, &cq_create->u.request.context, eq->queue_id); | 10420 | bf_set(lpfc_mbox_hdr_version, &shdr->request, |
10421 | phba->sli4_hba.pc_sli4_params.cqv); | ||
10422 | if (phba->sli4_hba.pc_sli4_params.cqv == LPFC_Q_CREATE_VERSION_2) { | ||
10423 | bf_set(lpfc_mbx_cq_create_page_size, &cq_create->u.request, | ||
10424 | (PAGE_SIZE/SLI4_PAGE_SIZE)); | ||
10425 | bf_set(lpfc_cq_eq_id_2, &cq_create->u.request.context, | ||
10426 | eq->queue_id); | ||
10427 | } else { | ||
10428 | bf_set(lpfc_cq_eq_id, &cq_create->u.request.context, | ||
10429 | eq->queue_id); | ||
10430 | } | ||
10421 | switch (cq->entry_count) { | 10431 | switch (cq->entry_count) { |
10422 | default: | 10432 | default: |
10423 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 10433 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
@@ -10449,7 +10459,6 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq, | |||
10449 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); | 10459 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); |
10450 | 10460 | ||
10451 | /* The IOCTL status is embedded in the mailbox subheader. */ | 10461 | /* The IOCTL status is embedded in the mailbox subheader. */ |
10452 | shdr = (union lpfc_sli4_cfg_shdr *) &cq_create->header.cfg_shdr; | ||
10453 | shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); | 10462 | shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); |
10454 | shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); | 10463 | shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); |
10455 | if (shdr_status || shdr_add_status || rc) { | 10464 | if (shdr_status || shdr_add_status || rc) { |
@@ -10515,20 +10524,20 @@ lpfc_mq_create_fb_init(struct lpfc_hba *phba, struct lpfc_queue *mq, | |||
10515 | bf_set(lpfc_mq_context_valid, &mq_create->u.request.context, 1); | 10524 | bf_set(lpfc_mq_context_valid, &mq_create->u.request.context, 1); |
10516 | switch (mq->entry_count) { | 10525 | switch (mq->entry_count) { |
10517 | case 16: | 10526 | case 16: |
10518 | bf_set(lpfc_mq_context_count, &mq_create->u.request.context, | 10527 | bf_set(lpfc_mq_context_ring_size, &mq_create->u.request.context, |
10519 | LPFC_MQ_CNT_16); | 10528 | LPFC_MQ_RING_SIZE_16); |
10520 | break; | 10529 | break; |
10521 | case 32: | 10530 | case 32: |
10522 | bf_set(lpfc_mq_context_count, &mq_create->u.request.context, | 10531 | bf_set(lpfc_mq_context_ring_size, &mq_create->u.request.context, |
10523 | LPFC_MQ_CNT_32); | 10532 | LPFC_MQ_RING_SIZE_32); |
10524 | break; | 10533 | break; |
10525 | case 64: | 10534 | case 64: |
10526 | bf_set(lpfc_mq_context_count, &mq_create->u.request.context, | 10535 | bf_set(lpfc_mq_context_ring_size, &mq_create->u.request.context, |
10527 | LPFC_MQ_CNT_64); | 10536 | LPFC_MQ_RING_SIZE_64); |
10528 | break; | 10537 | break; |
10529 | case 128: | 10538 | case 128: |
10530 | bf_set(lpfc_mq_context_count, &mq_create->u.request.context, | 10539 | bf_set(lpfc_mq_context_ring_size, &mq_create->u.request.context, |
10531 | LPFC_MQ_CNT_128); | 10540 | LPFC_MQ_RING_SIZE_128); |
10532 | break; | 10541 | break; |
10533 | } | 10542 | } |
10534 | list_for_each_entry(dmabuf, &mq->page_list, list) { | 10543 | list_for_each_entry(dmabuf, &mq->page_list, list) { |
@@ -10586,6 +10595,7 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq, | |||
10586 | length, LPFC_SLI4_MBX_EMBED); | 10595 | length, LPFC_SLI4_MBX_EMBED); |
10587 | 10596 | ||
10588 | mq_create_ext = &mbox->u.mqe.un.mq_create_ext; | 10597 | mq_create_ext = &mbox->u.mqe.un.mq_create_ext; |
10598 | shdr = (union lpfc_sli4_cfg_shdr *) &mq_create_ext->header.cfg_shdr; | ||
10589 | bf_set(lpfc_mbx_mq_create_ext_num_pages, | 10599 | bf_set(lpfc_mbx_mq_create_ext_num_pages, |
10590 | &mq_create_ext->u.request, mq->page_count); | 10600 | &mq_create_ext->u.request, mq->page_count); |
10591 | bf_set(lpfc_mbx_mq_create_ext_async_evt_link, | 10601 | bf_set(lpfc_mbx_mq_create_ext_async_evt_link, |
@@ -10598,9 +10608,15 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq, | |||
10598 | &mq_create_ext->u.request, 1); | 10608 | &mq_create_ext->u.request, 1); |
10599 | bf_set(lpfc_mbx_mq_create_ext_async_evt_sli, | 10609 | bf_set(lpfc_mbx_mq_create_ext_async_evt_sli, |
10600 | &mq_create_ext->u.request, 1); | 10610 | &mq_create_ext->u.request, 1); |
10601 | bf_set(lpfc_mq_context_cq_id, | ||
10602 | &mq_create_ext->u.request.context, cq->queue_id); | ||
10603 | bf_set(lpfc_mq_context_valid, &mq_create_ext->u.request.context, 1); | 10611 | bf_set(lpfc_mq_context_valid, &mq_create_ext->u.request.context, 1); |
10612 | bf_set(lpfc_mbox_hdr_version, &shdr->request, | ||
10613 | phba->sli4_hba.pc_sli4_params.mqv); | ||
10614 | if (phba->sli4_hba.pc_sli4_params.mqv == LPFC_Q_CREATE_VERSION_1) | ||
10615 | bf_set(lpfc_mbx_mq_create_ext_cq_id, &mq_create_ext->u.request, | ||
10616 | cq->queue_id); | ||
10617 | else | ||
10618 | bf_set(lpfc_mq_context_cq_id, &mq_create_ext->u.request.context, | ||
10619 | cq->queue_id); | ||
10604 | switch (mq->entry_count) { | 10620 | switch (mq->entry_count) { |
10605 | default: | 10621 | default: |
10606 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 10622 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
@@ -10610,20 +10626,24 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq, | |||
10610 | return -EINVAL; | 10626 | return -EINVAL; |
10611 | /* otherwise default to smallest count (drop through) */ | 10627 | /* otherwise default to smallest count (drop through) */ |
10612 | case 16: | 10628 | case 16: |
10613 | bf_set(lpfc_mq_context_count, &mq_create_ext->u.request.context, | 10629 | bf_set(lpfc_mq_context_ring_size, |
10614 | LPFC_MQ_CNT_16); | 10630 | &mq_create_ext->u.request.context, |
10631 | LPFC_MQ_RING_SIZE_16); | ||
10615 | break; | 10632 | break; |
10616 | case 32: | 10633 | case 32: |
10617 | bf_set(lpfc_mq_context_count, &mq_create_ext->u.request.context, | 10634 | bf_set(lpfc_mq_context_ring_size, |
10618 | LPFC_MQ_CNT_32); | 10635 | &mq_create_ext->u.request.context, |
10636 | LPFC_MQ_RING_SIZE_32); | ||
10619 | break; | 10637 | break; |
10620 | case 64: | 10638 | case 64: |
10621 | bf_set(lpfc_mq_context_count, &mq_create_ext->u.request.context, | 10639 | bf_set(lpfc_mq_context_ring_size, |
10622 | LPFC_MQ_CNT_64); | 10640 | &mq_create_ext->u.request.context, |
10641 | LPFC_MQ_RING_SIZE_64); | ||
10623 | break; | 10642 | break; |
10624 | case 128: | 10643 | case 128: |
10625 | bf_set(lpfc_mq_context_count, &mq_create_ext->u.request.context, | 10644 | bf_set(lpfc_mq_context_ring_size, |
10626 | LPFC_MQ_CNT_128); | 10645 | &mq_create_ext->u.request.context, |
10646 | LPFC_MQ_RING_SIZE_128); | ||
10627 | break; | 10647 | break; |
10628 | } | 10648 | } |
10629 | list_for_each_entry(dmabuf, &mq->page_list, list) { | 10649 | list_for_each_entry(dmabuf, &mq->page_list, list) { |
@@ -10634,7 +10654,6 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq, | |||
10634 | putPaddrHigh(dmabuf->phys); | 10654 | putPaddrHigh(dmabuf->phys); |
10635 | } | 10655 | } |
10636 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); | 10656 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); |
10637 | shdr = (union lpfc_sli4_cfg_shdr *) &mq_create_ext->header.cfg_shdr; | ||
10638 | mq->queue_id = bf_get(lpfc_mbx_mq_create_q_id, | 10657 | mq->queue_id = bf_get(lpfc_mbx_mq_create_q_id, |
10639 | &mq_create_ext->u.response); | 10658 | &mq_create_ext->u.response); |
10640 | if (rc != MBX_SUCCESS) { | 10659 | if (rc != MBX_SUCCESS) { |
@@ -10711,6 +10730,7 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq, | |||
10711 | uint32_t shdr_status, shdr_add_status; | 10730 | uint32_t shdr_status, shdr_add_status; |
10712 | union lpfc_sli4_cfg_shdr *shdr; | 10731 | union lpfc_sli4_cfg_shdr *shdr; |
10713 | uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; | 10732 | uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; |
10733 | struct dma_address *page; | ||
10714 | 10734 | ||
10715 | if (!phba->sli4_hba.pc_sli4_params.supported) | 10735 | if (!phba->sli4_hba.pc_sli4_params.supported) |
10716 | hw_page_size = SLI4_PAGE_SIZE; | 10736 | hw_page_size = SLI4_PAGE_SIZE; |
@@ -10724,20 +10744,42 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq, | |||
10724 | LPFC_MBOX_OPCODE_FCOE_WQ_CREATE, | 10744 | LPFC_MBOX_OPCODE_FCOE_WQ_CREATE, |
10725 | length, LPFC_SLI4_MBX_EMBED); | 10745 | length, LPFC_SLI4_MBX_EMBED); |
10726 | wq_create = &mbox->u.mqe.un.wq_create; | 10746 | wq_create = &mbox->u.mqe.un.wq_create; |
10747 | shdr = (union lpfc_sli4_cfg_shdr *) &wq_create->header.cfg_shdr; | ||
10727 | bf_set(lpfc_mbx_wq_create_num_pages, &wq_create->u.request, | 10748 | bf_set(lpfc_mbx_wq_create_num_pages, &wq_create->u.request, |
10728 | wq->page_count); | 10749 | wq->page_count); |
10729 | bf_set(lpfc_mbx_wq_create_cq_id, &wq_create->u.request, | 10750 | bf_set(lpfc_mbx_wq_create_cq_id, &wq_create->u.request, |
10730 | cq->queue_id); | 10751 | cq->queue_id); |
10752 | bf_set(lpfc_mbox_hdr_version, &shdr->request, | ||
10753 | phba->sli4_hba.pc_sli4_params.wqv); | ||
10754 | if (phba->sli4_hba.pc_sli4_params.wqv == LPFC_Q_CREATE_VERSION_1) { | ||
10755 | bf_set(lpfc_mbx_wq_create_wqe_count, &wq_create->u.request_1, | ||
10756 | wq->entry_count); | ||
10757 | switch (wq->entry_size) { | ||
10758 | default: | ||
10759 | case 64: | ||
10760 | bf_set(lpfc_mbx_wq_create_wqe_size, | ||
10761 | &wq_create->u.request_1, | ||
10762 | LPFC_WQ_WQE_SIZE_64); | ||
10763 | break; | ||
10764 | case 128: | ||
10765 | bf_set(lpfc_mbx_wq_create_wqe_size, | ||
10766 | &wq_create->u.request_1, | ||
10767 | LPFC_WQ_WQE_SIZE_128); | ||
10768 | break; | ||
10769 | } | ||
10770 | bf_set(lpfc_mbx_wq_create_page_size, &wq_create->u.request_1, | ||
10771 | (PAGE_SIZE/SLI4_PAGE_SIZE)); | ||
10772 | page = wq_create->u.request_1.page; | ||
10773 | } else { | ||
10774 | page = wq_create->u.request.page; | ||
10775 | } | ||
10731 | list_for_each_entry(dmabuf, &wq->page_list, list) { | 10776 | list_for_each_entry(dmabuf, &wq->page_list, list) { |
10732 | memset(dmabuf->virt, 0, hw_page_size); | 10777 | memset(dmabuf->virt, 0, hw_page_size); |
10733 | wq_create->u.request.page[dmabuf->buffer_tag].addr_lo = | 10778 | page[dmabuf->buffer_tag].addr_lo = putPaddrLow(dmabuf->phys); |
10734 | putPaddrLow(dmabuf->phys); | 10779 | page[dmabuf->buffer_tag].addr_hi = putPaddrHigh(dmabuf->phys); |
10735 | wq_create->u.request.page[dmabuf->buffer_tag].addr_hi = | ||
10736 | putPaddrHigh(dmabuf->phys); | ||
10737 | } | 10780 | } |
10738 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); | 10781 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); |
10739 | /* The IOCTL status is embedded in the mailbox subheader. */ | 10782 | /* The IOCTL status is embedded in the mailbox subheader. */ |
10740 | shdr = (union lpfc_sli4_cfg_shdr *) &wq_create->header.cfg_shdr; | ||
10741 | shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); | 10783 | shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); |
10742 | shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); | 10784 | shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); |
10743 | if (shdr_status || shdr_add_status || rc) { | 10785 | if (shdr_status || shdr_add_status || rc) { |
@@ -10815,37 +10857,51 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq, | |||
10815 | LPFC_MBOX_OPCODE_FCOE_RQ_CREATE, | 10857 | LPFC_MBOX_OPCODE_FCOE_RQ_CREATE, |
10816 | length, LPFC_SLI4_MBX_EMBED); | 10858 | length, LPFC_SLI4_MBX_EMBED); |
10817 | rq_create = &mbox->u.mqe.un.rq_create; | 10859 | rq_create = &mbox->u.mqe.un.rq_create; |
10818 | switch (hrq->entry_count) { | 10860 | shdr = (union lpfc_sli4_cfg_shdr *) &rq_create->header.cfg_shdr; |
10819 | default: | 10861 | bf_set(lpfc_mbox_hdr_version, &shdr->request, |
10820 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 10862 | phba->sli4_hba.pc_sli4_params.rqv); |
10821 | "2535 Unsupported RQ count. (%d)\n", | 10863 | if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) { |
10822 | hrq->entry_count); | 10864 | bf_set(lpfc_rq_context_rqe_count_1, |
10823 | if (hrq->entry_count < 512) | 10865 | &rq_create->u.request.context, |
10824 | return -EINVAL; | 10866 | hrq->entry_count); |
10825 | /* otherwise default to smallest count (drop through) */ | 10867 | rq_create->u.request.context.buffer_size = LPFC_HDR_BUF_SIZE; |
10826 | case 512: | 10868 | } else { |
10827 | bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, | 10869 | switch (hrq->entry_count) { |
10828 | LPFC_RQ_RING_SIZE_512); | 10870 | default: |
10829 | break; | 10871 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
10830 | case 1024: | 10872 | "2535 Unsupported RQ count. (%d)\n", |
10831 | bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, | 10873 | hrq->entry_count); |
10832 | LPFC_RQ_RING_SIZE_1024); | 10874 | if (hrq->entry_count < 512) |
10833 | break; | 10875 | return -EINVAL; |
10834 | case 2048: | 10876 | /* otherwise default to smallest count (drop through) */ |
10835 | bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, | 10877 | case 512: |
10836 | LPFC_RQ_RING_SIZE_2048); | 10878 | bf_set(lpfc_rq_context_rqe_count, |
10837 | break; | 10879 | &rq_create->u.request.context, |
10838 | case 4096: | 10880 | LPFC_RQ_RING_SIZE_512); |
10839 | bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, | 10881 | break; |
10840 | LPFC_RQ_RING_SIZE_4096); | 10882 | case 1024: |
10841 | break; | 10883 | bf_set(lpfc_rq_context_rqe_count, |
10884 | &rq_create->u.request.context, | ||
10885 | LPFC_RQ_RING_SIZE_1024); | ||
10886 | break; | ||
10887 | case 2048: | ||
10888 | bf_set(lpfc_rq_context_rqe_count, | ||
10889 | &rq_create->u.request.context, | ||
10890 | LPFC_RQ_RING_SIZE_2048); | ||
10891 | break; | ||
10892 | case 4096: | ||
10893 | bf_set(lpfc_rq_context_rqe_count, | ||
10894 | &rq_create->u.request.context, | ||
10895 | LPFC_RQ_RING_SIZE_4096); | ||
10896 | break; | ||
10897 | } | ||
10898 | bf_set(lpfc_rq_context_buf_size, &rq_create->u.request.context, | ||
10899 | LPFC_HDR_BUF_SIZE); | ||
10842 | } | 10900 | } |
10843 | bf_set(lpfc_rq_context_cq_id, &rq_create->u.request.context, | 10901 | bf_set(lpfc_rq_context_cq_id, &rq_create->u.request.context, |
10844 | cq->queue_id); | 10902 | cq->queue_id); |
10845 | bf_set(lpfc_mbx_rq_create_num_pages, &rq_create->u.request, | 10903 | bf_set(lpfc_mbx_rq_create_num_pages, &rq_create->u.request, |
10846 | hrq->page_count); | 10904 | hrq->page_count); |
10847 | bf_set(lpfc_rq_context_buf_size, &rq_create->u.request.context, | ||
10848 | LPFC_HDR_BUF_SIZE); | ||
10849 | list_for_each_entry(dmabuf, &hrq->page_list, list) { | 10905 | list_for_each_entry(dmabuf, &hrq->page_list, list) { |
10850 | memset(dmabuf->virt, 0, hw_page_size); | 10906 | memset(dmabuf->virt, 0, hw_page_size); |
10851 | rq_create->u.request.page[dmabuf->buffer_tag].addr_lo = | 10907 | rq_create->u.request.page[dmabuf->buffer_tag].addr_lo = |
@@ -10855,7 +10911,6 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq, | |||
10855 | } | 10911 | } |
10856 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); | 10912 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); |
10857 | /* The IOCTL status is embedded in the mailbox subheader. */ | 10913 | /* The IOCTL status is embedded in the mailbox subheader. */ |
10858 | shdr = (union lpfc_sli4_cfg_shdr *) &rq_create->header.cfg_shdr; | ||
10859 | shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); | 10914 | shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); |
10860 | shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); | 10915 | shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); |
10861 | if (shdr_status || shdr_add_status || rc) { | 10916 | if (shdr_status || shdr_add_status || rc) { |
@@ -10881,37 +10936,50 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq, | |||
10881 | lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, | 10936 | lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, |
10882 | LPFC_MBOX_OPCODE_FCOE_RQ_CREATE, | 10937 | LPFC_MBOX_OPCODE_FCOE_RQ_CREATE, |
10883 | length, LPFC_SLI4_MBX_EMBED); | 10938 | length, LPFC_SLI4_MBX_EMBED); |
10884 | switch (drq->entry_count) { | 10939 | bf_set(lpfc_mbox_hdr_version, &shdr->request, |
10885 | default: | 10940 | phba->sli4_hba.pc_sli4_params.rqv); |
10886 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 10941 | if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) { |
10887 | "2536 Unsupported RQ count. (%d)\n", | 10942 | bf_set(lpfc_rq_context_rqe_count_1, |
10888 | drq->entry_count); | 10943 | &rq_create->u.request.context, |
10889 | if (drq->entry_count < 512) | 10944 | hrq->entry_count); |
10890 | return -EINVAL; | 10945 | rq_create->u.request.context.buffer_size = LPFC_DATA_BUF_SIZE; |
10891 | /* otherwise default to smallest count (drop through) */ | 10946 | } else { |
10892 | case 512: | 10947 | switch (drq->entry_count) { |
10893 | bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, | 10948 | default: |
10894 | LPFC_RQ_RING_SIZE_512); | 10949 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
10895 | break; | 10950 | "2536 Unsupported RQ count. (%d)\n", |
10896 | case 1024: | 10951 | drq->entry_count); |
10897 | bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, | 10952 | if (drq->entry_count < 512) |
10898 | LPFC_RQ_RING_SIZE_1024); | 10953 | return -EINVAL; |
10899 | break; | 10954 | /* otherwise default to smallest count (drop through) */ |
10900 | case 2048: | 10955 | case 512: |
10901 | bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, | 10956 | bf_set(lpfc_rq_context_rqe_count, |
10902 | LPFC_RQ_RING_SIZE_2048); | 10957 | &rq_create->u.request.context, |
10903 | break; | 10958 | LPFC_RQ_RING_SIZE_512); |
10904 | case 4096: | 10959 | break; |
10905 | bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, | 10960 | case 1024: |
10906 | LPFC_RQ_RING_SIZE_4096); | 10961 | bf_set(lpfc_rq_context_rqe_count, |
10907 | break; | 10962 | &rq_create->u.request.context, |
10963 | LPFC_RQ_RING_SIZE_1024); | ||
10964 | break; | ||
10965 | case 2048: | ||
10966 | bf_set(lpfc_rq_context_rqe_count, | ||
10967 | &rq_create->u.request.context, | ||
10968 | LPFC_RQ_RING_SIZE_2048); | ||
10969 | break; | ||
10970 | case 4096: | ||
10971 | bf_set(lpfc_rq_context_rqe_count, | ||
10972 | &rq_create->u.request.context, | ||
10973 | LPFC_RQ_RING_SIZE_4096); | ||
10974 | break; | ||
10975 | } | ||
10976 | bf_set(lpfc_rq_context_buf_size, &rq_create->u.request.context, | ||
10977 | LPFC_DATA_BUF_SIZE); | ||
10908 | } | 10978 | } |
10909 | bf_set(lpfc_rq_context_cq_id, &rq_create->u.request.context, | 10979 | bf_set(lpfc_rq_context_cq_id, &rq_create->u.request.context, |
10910 | cq->queue_id); | 10980 | cq->queue_id); |
10911 | bf_set(lpfc_mbx_rq_create_num_pages, &rq_create->u.request, | 10981 | bf_set(lpfc_mbx_rq_create_num_pages, &rq_create->u.request, |
10912 | drq->page_count); | 10982 | drq->page_count); |
10913 | bf_set(lpfc_rq_context_buf_size, &rq_create->u.request.context, | ||
10914 | LPFC_DATA_BUF_SIZE); | ||
10915 | list_for_each_entry(dmabuf, &drq->page_list, list) { | 10983 | list_for_each_entry(dmabuf, &drq->page_list, list) { |
10916 | rq_create->u.request.page[dmabuf->buffer_tag].addr_lo = | 10984 | rq_create->u.request.page[dmabuf->buffer_tag].addr_lo = |
10917 | putPaddrLow(dmabuf->phys); | 10985 | putPaddrLow(dmabuf->phys); |