• Home
  • Raw
  • Download

Lines Matching refs:cq

656 	struct mthca_cq *cq;  in mthca_create_cq()  local
683 cq = kmalloc(sizeof *cq, GFP_KERNEL); in mthca_create_cq()
684 if (!cq) { in mthca_create_cq()
690 cq->buf.mr.ibmr.lkey = ucmd.lkey; in mthca_create_cq()
691 cq->set_ci_db_index = ucmd.set_db_index; in mthca_create_cq()
692 cq->arm_db_index = ucmd.arm_db_index; in mthca_create_cq()
701 cq); in mthca_create_cq()
705 if (context && ib_copy_to_udata(udata, &cq->cqn, sizeof (__u32))) { in mthca_create_cq()
706 mthca_free_cq(to_mdev(ibdev), cq); in mthca_create_cq()
711 cq->resize_buf = NULL; in mthca_create_cq()
713 return &cq->ibcq; in mthca_create_cq()
716 kfree(cq); in mthca_create_cq()
731 static int mthca_alloc_resize_buf(struct mthca_dev *dev, struct mthca_cq *cq, in mthca_alloc_resize_buf() argument
736 spin_lock_irq(&cq->lock); in mthca_alloc_resize_buf()
737 if (cq->resize_buf) { in mthca_alloc_resize_buf()
742 cq->resize_buf = kmalloc(sizeof *cq->resize_buf, GFP_ATOMIC); in mthca_alloc_resize_buf()
743 if (!cq->resize_buf) { in mthca_alloc_resize_buf()
748 cq->resize_buf->state = CQ_RESIZE_ALLOC; in mthca_alloc_resize_buf()
753 spin_unlock_irq(&cq->lock); in mthca_alloc_resize_buf()
758 ret = mthca_alloc_cq_buf(dev, &cq->resize_buf->buf, entries); in mthca_alloc_resize_buf()
760 spin_lock_irq(&cq->lock); in mthca_alloc_resize_buf()
761 kfree(cq->resize_buf); in mthca_alloc_resize_buf()
762 cq->resize_buf = NULL; in mthca_alloc_resize_buf()
763 spin_unlock_irq(&cq->lock); in mthca_alloc_resize_buf()
767 cq->resize_buf->cqe = entries - 1; in mthca_alloc_resize_buf()
769 spin_lock_irq(&cq->lock); in mthca_alloc_resize_buf()
770 cq->resize_buf->state = CQ_RESIZE_READY; in mthca_alloc_resize_buf()
771 spin_unlock_irq(&cq->lock); in mthca_alloc_resize_buf()
779 struct mthca_cq *cq = to_mcq(ibcq); in mthca_resize_cq() local
787 mutex_lock(&cq->mutex); in mthca_resize_cq()
795 if (cq->is_kernel) { in mthca_resize_cq()
796 ret = mthca_alloc_resize_buf(dev, cq, entries); in mthca_resize_cq()
799 lkey = cq->resize_buf->buf.mr.ibmr.lkey; in mthca_resize_cq()
808 ret = mthca_RESIZE_CQ(dev, cq->cqn, lkey, ilog2(entries)); in mthca_resize_cq()
811 if (cq->resize_buf) { in mthca_resize_cq()
812 mthca_free_cq_buf(dev, &cq->resize_buf->buf, in mthca_resize_cq()
813 cq->resize_buf->cqe); in mthca_resize_cq()
814 kfree(cq->resize_buf); in mthca_resize_cq()
815 spin_lock_irq(&cq->lock); in mthca_resize_cq()
816 cq->resize_buf = NULL; in mthca_resize_cq()
817 spin_unlock_irq(&cq->lock); in mthca_resize_cq()
822 if (cq->is_kernel) { in mthca_resize_cq()
826 spin_lock_irq(&cq->lock); in mthca_resize_cq()
827 if (cq->resize_buf->state == CQ_RESIZE_READY) { in mthca_resize_cq()
828 mthca_cq_resize_copy_cqes(cq); in mthca_resize_cq()
829 tbuf = cq->buf; in mthca_resize_cq()
830 tcqe = cq->ibcq.cqe; in mthca_resize_cq()
831 cq->buf = cq->resize_buf->buf; in mthca_resize_cq()
832 cq->ibcq.cqe = cq->resize_buf->cqe; in mthca_resize_cq()
834 tbuf = cq->resize_buf->buf; in mthca_resize_cq()
835 tcqe = cq->resize_buf->cqe; in mthca_resize_cq()
838 kfree(cq->resize_buf); in mthca_resize_cq()
839 cq->resize_buf = NULL; in mthca_resize_cq()
840 spin_unlock_irq(&cq->lock); in mthca_resize_cq()
847 mutex_unlock(&cq->mutex); in mthca_resize_cq()
852 static int mthca_destroy_cq(struct ib_cq *cq) in mthca_destroy_cq() argument
854 if (cq->uobject) { in mthca_destroy_cq()
855 mthca_unmap_user_db(to_mdev(cq->device), in mthca_destroy_cq()
856 &to_mucontext(cq->uobject->context)->uar, in mthca_destroy_cq()
857 to_mucontext(cq->uobject->context)->db_tab, in mthca_destroy_cq()
858 to_mcq(cq)->arm_db_index); in mthca_destroy_cq()
859 mthca_unmap_user_db(to_mdev(cq->device), in mthca_destroy_cq()
860 &to_mucontext(cq->uobject->context)->uar, in mthca_destroy_cq()
861 to_mucontext(cq->uobject->context)->db_tab, in mthca_destroy_cq()
862 to_mcq(cq)->set_ci_db_index); in mthca_destroy_cq()
864 mthca_free_cq(to_mdev(cq->device), to_mcq(cq)); in mthca_destroy_cq()
865 kfree(cq); in mthca_destroy_cq()