On 02/09/2019 19:23, Michal Kalderon wrote: > int efa_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata) > { > + struct efa_ucontext *ucontext = rdma_udata_to_drv_context(udata, > + struct efa_ucontext, ibucontext); > struct efa_dev *dev = to_edev(ibqp->pd->device); > struct efa_qp *qp = to_eqp(ibqp); > int err; > > ibdev_dbg(&dev->ibdev, "Destroy qp[%u]\n", ibqp->qp_num); > + > + efa_qp_user_mmap_entries_remove(ucontext, qp); > + > err = efa_destroy_qp_handle(dev, qp->qp_handle); > if (err) > return err; > @@ -509,57 +412,114 @@ int efa_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata) > return 0; > } > > void efa_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata) > { > + struct efa_ucontext *ucontext = rdma_udata_to_drv_context(udata, > + struct efa_ucontext, ibucontext); > + > struct efa_dev *dev = to_edev(ibcq->device); > struct efa_cq *cq = to_ecq(ibcq); > > @@ -897,17 +862,28 @@ void efa_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata) > efa_destroy_cq_idx(dev, cq->cq_idx); > dma_unmap_single(&dev->pdev->dev, cq->dma_addr, cq->size, > DMA_FROM_DEVICE); > + rdma_user_mmap_entry_remove(&ucontext->ibucontext, > + cq->mmap_key); How come in destroy_qp we do entry removal first, but in destroy_cq it's last? Shouldn't it be the same?