.. | .. |
---|
650 | 650 | } |
---|
651 | 651 | |
---|
652 | 652 | int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr, |
---|
653 | | - u64 *pbl_tbl, int num_pbls, bool block, u32 buf_pg_size) |
---|
| 653 | + struct ib_umem *umem, int num_pbls, u32 buf_pg_size) |
---|
654 | 654 | { |
---|
655 | 655 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
---|
656 | 656 | struct bnxt_qplib_hwq_attr hwq_attr = {}; |
---|
657 | 657 | struct bnxt_qplib_sg_info sginfo = {}; |
---|
658 | 658 | struct creq_register_mr_resp resp; |
---|
659 | 659 | struct cmdq_register_mr req; |
---|
660 | | - int pg_ptrs, pages, i, rc; |
---|
661 | 660 | u16 cmd_flags = 0, level; |
---|
662 | | - dma_addr_t **pbl_ptr; |
---|
| 661 | + int pages, rc, pg_ptrs; |
---|
663 | 662 | u32 pg_size; |
---|
664 | 663 | |
---|
665 | 664 | if (num_pbls) { |
---|
.. | .. |
---|
680 | 679 | /* Free the hwq if it already exist, must be a rereg */ |
---|
681 | 680 | if (mr->hwq.max_elements) |
---|
682 | 681 | bnxt_qplib_free_hwq(res, &mr->hwq); |
---|
683 | | - /* Use system PAGE_SIZE */ |
---|
684 | 682 | hwq_attr.res = res; |
---|
685 | 683 | hwq_attr.depth = pages; |
---|
686 | | - hwq_attr.stride = PAGE_SIZE; |
---|
| 684 | + hwq_attr.stride = sizeof(dma_addr_t); |
---|
687 | 685 | hwq_attr.type = HWQ_TYPE_MR; |
---|
688 | 686 | hwq_attr.sginfo = &sginfo; |
---|
| 687 | + hwq_attr.sginfo->umem = umem; |
---|
689 | 688 | hwq_attr.sginfo->npages = pages; |
---|
690 | | - hwq_attr.sginfo->pgsize = PAGE_SIZE; |
---|
691 | | - hwq_attr.sginfo->pgshft = PAGE_SHIFT; |
---|
| 689 | + hwq_attr.sginfo->pgsize = buf_pg_size; |
---|
| 690 | + hwq_attr.sginfo->pgshft = ilog2(buf_pg_size); |
---|
692 | 691 | rc = bnxt_qplib_alloc_init_hwq(&mr->hwq, &hwq_attr); |
---|
693 | 692 | if (rc) { |
---|
694 | 693 | dev_err(&res->pdev->dev, |
---|
695 | 694 | "SP: Reg MR memory allocation failed\n"); |
---|
696 | 695 | return -ENOMEM; |
---|
697 | 696 | } |
---|
698 | | - /* Write to the hwq */ |
---|
699 | | - pbl_ptr = (dma_addr_t **)mr->hwq.pbl_ptr; |
---|
700 | | - for (i = 0; i < num_pbls; i++) |
---|
701 | | - pbl_ptr[PTR_PG(i)][PTR_IDX(i)] = |
---|
702 | | - (pbl_tbl[i] & PAGE_MASK) | PTU_PTE_VALID; |
---|
703 | 697 | } |
---|
704 | 698 | |
---|
705 | 699 | RCFW_CMD_PREP(req, REGISTER_MR, cmd_flags); |
---|
.. | .. |
---|
711 | 705 | req.pbl = 0; |
---|
712 | 706 | pg_size = PAGE_SIZE; |
---|
713 | 707 | } else { |
---|
714 | | - level = mr->hwq.level + 1; |
---|
| 708 | + level = mr->hwq.level; |
---|
715 | 709 | req.pbl = cpu_to_le64(mr->hwq.pbl[PBL_LVL_0].pg_map_arr[0]); |
---|
716 | 710 | } |
---|
717 | 711 | pg_size = buf_pg_size ? buf_pg_size : PAGE_SIZE; |
---|
.. | .. |
---|
728 | 722 | req.mr_size = cpu_to_le64(mr->total_size); |
---|
729 | 723 | |
---|
730 | 724 | rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, |
---|
731 | | - (void *)&resp, NULL, block); |
---|
| 725 | + (void *)&resp, NULL, false); |
---|
732 | 726 | if (rc) |
---|
733 | 727 | goto fail; |
---|
734 | 728 | |
---|