Lines Matching refs:cq
78 struct mlx4_cq *cq; in mlx4_cq_completion() local
80 cq = radix_tree_lookup(&mlx4_priv(dev)->cq_table.tree, in mlx4_cq_completion()
82 if (!cq) { in mlx4_cq_completion()
87 ++cq->arm_sn; in mlx4_cq_completion()
89 cq->comp(cq); in mlx4_cq_completion()
95 struct mlx4_cq *cq; in mlx4_cq_event() local
99 cq = radix_tree_lookup(&cq_table->tree, cqn & (dev->caps.num_cqs - 1)); in mlx4_cq_event()
100 if (cq) in mlx4_cq_event()
101 atomic_inc(&cq->refcount); in mlx4_cq_event()
105 if (!cq) { in mlx4_cq_event()
110 cq->event(cq, event_type); in mlx4_cq_event()
112 if (atomic_dec_and_test(&cq->refcount)) in mlx4_cq_event()
113 complete(&cq->free); in mlx4_cq_event()
138 int mlx4_cq_modify(struct mlx4_dev *dev, struct mlx4_cq *cq, in mlx4_cq_modify() argument
155 err = mlx4_MODIFY_CQ(dev, mailbox, cq->cqn, 1); in mlx4_cq_modify()
162 int mlx4_cq_resize(struct mlx4_dev *dev, struct mlx4_cq *cq, in mlx4_cq_resize() argument
183 err = mlx4_MODIFY_CQ(dev, mailbox, cq->cqn, 0); in mlx4_cq_resize()
191 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, in mlx4_cq_alloc() argument
204 cq->vector = vector; in mlx4_cq_alloc()
206 cq->cqn = mlx4_bitmap_alloc(&cq_table->bitmap); in mlx4_cq_alloc()
207 if (cq->cqn == -1) in mlx4_cq_alloc()
210 err = mlx4_table_get(dev, &cq_table->table, cq->cqn); in mlx4_cq_alloc()
214 err = mlx4_table_get(dev, &cq_table->cmpt_table, cq->cqn); in mlx4_cq_alloc()
219 err = radix_tree_insert(&cq_table->tree, cq->cqn, cq); in mlx4_cq_alloc()
243 err = mlx4_SW2HW_CQ(dev, mailbox, cq->cqn); in mlx4_cq_alloc()
248 cq->cons_index = 0; in mlx4_cq_alloc()
249 cq->arm_sn = 1; in mlx4_cq_alloc()
250 cq->uar = uar; in mlx4_cq_alloc()
251 atomic_set(&cq->refcount, 1); in mlx4_cq_alloc()
252 init_completion(&cq->free); in mlx4_cq_alloc()
258 radix_tree_delete(&cq_table->tree, cq->cqn); in mlx4_cq_alloc()
262 mlx4_table_put(dev, &cq_table->cmpt_table, cq->cqn); in mlx4_cq_alloc()
265 mlx4_table_put(dev, &cq_table->table, cq->cqn); in mlx4_cq_alloc()
268 mlx4_bitmap_free(&cq_table->bitmap, cq->cqn); in mlx4_cq_alloc()
274 void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq) in mlx4_cq_free() argument
280 err = mlx4_HW2SW_CQ(dev, NULL, cq->cqn); in mlx4_cq_free()
282 mlx4_warn(dev, "HW2SW_CQ failed (%d) for CQN %06x\n", err, cq->cqn); in mlx4_cq_free()
284 synchronize_irq(priv->eq_table.eq[cq->vector].irq); in mlx4_cq_free()
287 radix_tree_delete(&cq_table->tree, cq->cqn); in mlx4_cq_free()
290 if (atomic_dec_and_test(&cq->refcount)) in mlx4_cq_free()
291 complete(&cq->free); in mlx4_cq_free()
292 wait_for_completion(&cq->free); in mlx4_cq_free()
294 mlx4_table_put(dev, &cq_table->table, cq->cqn); in mlx4_cq_free()
295 mlx4_bitmap_free(&cq_table->bitmap, cq->cqn); in mlx4_cq_free()