On Wed, Dec 12, 2018 at 05:49:05PM +0800, Lijun Ou wrote: > When flush cqe, it needs to get the pointer of rq and sq from > db address space of user and update it into qp context by > modified qp. if rq is not exist, it will not get the value > from db addresss space of user. This patch fixes it. > > Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx> > drivers/infiniband/hw/hns/hns_roce_qp.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c > index 52d2b29..55ba86f 100644 > +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c > @@ -675,6 +675,10 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, > dev_err(dev, "rq record doorbell map failed!\n"); > goto err_sq_dbmap; > } > + > + /* indicate kernel supports rq record db */ > + resp.cap_flags |= HNS_ROCE_SUPPORT_RQ_RECORD_DB; > + hr_qp->rdb_en = 1; > } > } else { > if (init_attr->create_flags & > @@ -783,16 +787,10 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, > else > hr_qp->doorbell_qpn = cpu_to_le64(hr_qp->qpn); > > - if (ib_pd->uobject && (udata->outlen >= sizeof(resp)) && > - (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB)) { > - > - /* indicate kernel supports rq record db */ > - resp.cap_flags |= HNS_ROCE_SUPPORT_RQ_RECORD_DB; > + if (ib_pd->uobject && (udata->outlen >= sizeof(resp))) { Drivers are no longer allowed to reference '->uobject', they should be using udata != NULL to detect if the API is called from kernel or user. Jason