On Fri, May 31, 2019 at 02:57:45PM +0800, Lijun Ou wrote: > + > +static int hns_roce_write_mtr(struct hns_roce_dev *hr_dev, > + struct hns_roce_mtr *mtr, dma_addr_t *bufs, > + struct hns_roce_buf_region *r) > +{ > + int offset; > + int count; > + int npage; > + u64 *mtts; > + int end; > + int i; > + > + offset = r->offset; > + end = offset + r->count; > + npage = 0; > + while (offset < end) { > + mtts = hns_roce_hem_list_find_mtt(hr_dev, &mtr->hem_list, > + offset, &count, NULL); > + if (!mtts) > + return -ENOBUFS; > + > + /* Save page addr, low 12 bits : 0 */ > + for (i = 0; i < count; i++) { > + if (hr_dev->hw_rev == HNS_ROCE_HW_VER1) > + mtts[i] = cpu_to_le64(bufs[npage] >> > + PAGE_ADDR_SHIFT); > + else > + mtts[i] = cpu_to_le64(bufs[npage]); > + > + npage++; > + } > + offset += count; > + } > + > + /* Memory barrier */ > + mb(); Didn't we talk about this already? Comments for all memory barriers have to be very good. Be really sure you are using the right barrier type for the right thing, because I won't take patches that get this stuff wrong. > +int hns_roce_mtr_find(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr, > + int offset, u64 *mtt_buf, int mtt_max, u64 *base_addr) > +{ > + u64 *mtts = mtt_buf; > + int mtt_count; > + int total = 0; > + u64 *addr; > + int npage; > + int left; > + > + if (mtts == NULL || mtt_max < 1) > + goto done; > + > + left = mtt_max; > + while (left > 0) { > + mtt_count = 0; > + addr = hns_roce_hem_list_find_mtt(hr_dev, &mtr->hem_list, > + offset + total, > + &mtt_count, NULL); > + if (!addr || !mtt_count) > + goto done; > + > + npage = min(mtt_count, left); > + memcpy(&mtts[total], addr, BA_BYTE_LEN * npage); > + left -= npage; > + total += npage; > + } > + > +done: > + if (base_addr) > + *base_addr = mtr->hem_list.root_ba; > + > + return total; > +} > +EXPORT_SYMBOL_GPL(hns_roce_mtr_find); Why is there an EXPROT_SYMBOL in a IB driver? I see many in hns. Please send a patch to remove all of them and respin this. Jason