在 2019/10/21 22:58, Doug Ledford 写道: > On Mon, 2019-10-21 at 22:20 +0800, oulijun wrote: >> 在 2019/10/21 22:13, Jason Gunthorpe 写道: >>> On Sat, Oct 19, 2019 at 04:46:12PM +0800, Lijun Ou wrote: >>>> index bd78ff9..722cc5f 100644 >>>> +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c >>>> @@ -377,6 +377,10 @@ static int hns_roce_set_user_sq_size(struct >>>> hns_roce_dev *hr_dev, >>>> hr_qp->sge.sge_cnt = roundup_pow_of_two(hr_qp- >>>>> sq.wqe_cnt * >>>> (hr_qp- >>>>> sq.max_gs - 2)); >>>> >>>> + if (hr_qp->ibqp.qp_type == IB_QPT_UD) >>>> + hr_qp->sge.sge_cnt = roundup_pow_of_two(hr_qp- >>>>> sq.wqe_cnt * >>>> + hr_qp- >>>>> sq.max_gs); >>>> + >>>> if ((hr_qp->sq.max_gs > 2) && (hr_dev->pci_dev->revision == >>>> 0x20)) { >>>> if (hr_qp->sge.sge_cnt > hr_dev->caps.max_extend_sg) { >>>> dev_err(hr_dev->dev, >>>> @@ -1022,6 +1026,9 @@ struct ib_qp *hns_roce_create_qp(struct >>>> ib_pd *pd, >>>> int ret; >>>> >>>> switch (init_attr->qp_type) { >>>> + case IB_QPT_UD: >>>> + if (!capable(CAP_NET_RAW)) >>>> + return -EPERM; >>> This needs a big comment explaining why this HW requires it. >>> >>> Jason >>> >> Add the detail comments for HW limit? > I can add those comments while taking the pactch. Plus we need to add a > fallthrough annotation at the same place. I'll fix it up and unfreeze > the hns queue. > Thanks