Unverified Commit b365433f authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!5905 [OLK 5.10] RDMA/hns: Fix incorrect iteration number of DCA umem sg...

!5905 [OLK 5.10] RDMA/hns: Fix incorrect iteration number of DCA umem sg entries and error return in hns_roce_v2_modify_srq()

Merge Pull Request from: @ZachXue 
 
Fix bugs:
- Fix incorrect iteration number of DCA umem sg entries. Use the entry number returned by IOMMU to set the maximum iteration number of DCA umem sg entries to fix this problem, instead of the originally allocated number.
- fix error return in hns_roce_v2_modify_srq(). When none of the conditions of the 'if' block are met, 0 should be returned instead of -EOPNOTSUPP. 
 
Link:https://gitee.com/openeuler/kernel/pulls/5905

 

Reviewed-by: default avatarChengchang Tang <tangchengchang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents ae52f9c5 b3315e6c
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -175,8 +175,7 @@ static void init_dca_umem_states(struct hns_dca_page_state *states, int count,
	int i = 0;

	pre_addr = 0;
	rdma_for_each_block(umem->sg_head.sgl, &biter,
			    umem->sg_head.nents, HNS_HW_PAGE_SIZE) {
	rdma_umem_for_each_dma_block(umem, &biter, HNS_HW_PAGE_SIZE) {
		cur_addr = rdma_block_iter_dma_address(&biter);
		if (i < count) {
			if (cur_addr - pre_addr != HNS_HW_PAGE_SIZE)
@@ -276,8 +275,7 @@ static int get_alloced_umem_proc(struct dca_mem *mem, int index, void *param)
	struct ib_block_iter biter;
	u32 i = 0;

	rdma_for_each_block(umem->sg_head.sgl, &biter,
			    umem->sg_head.nents, HNS_HW_PAGE_SIZE) {
	rdma_umem_for_each_dma_block(umem, &biter, HNS_HW_PAGE_SIZE) {
		if (dca_page_is_allocated(&states[i], attr->buf_id)) {
			attr->pages[attr->total++] =
					rdma_block_iter_dma_address(&biter);
+4 −2
Original line number Diff line number Diff line
@@ -6346,11 +6346,13 @@ static int hns_roce_v2_modify_srq(struct ib_srq *ibsrq,
	struct hns_roce_srq_context *srq_context;
	struct hns_roce_srq_context *srqc_mask;
	struct hns_roce_cmd_mailbox *mailbox;
	int ret = -EOPNOTSUPP;
	int ret = 0;

	/* Resizing SRQs is not supported yet */
	if (srq_attr_mask & IB_SRQ_MAX_WR)
	if (srq_attr_mask & IB_SRQ_MAX_WR) {
		ret = -EOPNOTSUPP;
		goto out;
	}

	if (srq_attr_mask & IB_SRQ_LIMIT) {
		if (srq_attr->srq_limit > srq->wqe_cnt) {