Lines Matching refs:cq
82 static void mlx4_add_cq_to_tasklet(struct mlx4_cq *cq) in mlx4_add_cq_to_tasklet() argument
85 struct mlx4_eq_tasklet *tasklet_ctx = cq->tasklet_ctx.priv; in mlx4_add_cq_to_tasklet()
93 if (list_empty_careful(&cq->tasklet_ctx.list)) { in mlx4_add_cq_to_tasklet()
94 atomic_inc(&cq->refcount); in mlx4_add_cq_to_tasklet()
95 list_add_tail(&cq->tasklet_ctx.list, &tasklet_ctx->list); in mlx4_add_cq_to_tasklet()
102 struct mlx4_cq *cq; in mlx4_cq_completion() local
104 cq = radix_tree_lookup(&mlx4_priv(dev)->cq_table.tree, in mlx4_cq_completion()
106 if (!cq) { in mlx4_cq_completion()
111 ++cq->arm_sn; in mlx4_cq_completion()
113 cq->comp(cq); in mlx4_cq_completion()
119 struct mlx4_cq *cq; in mlx4_cq_event() local
123 cq = radix_tree_lookup(&cq_table->tree, cqn & (dev->caps.num_cqs - 1)); in mlx4_cq_event()
124 if (cq) in mlx4_cq_event()
125 atomic_inc(&cq->refcount); in mlx4_cq_event()
129 if (!cq) { in mlx4_cq_event()
134 cq->event(cq, event_type); in mlx4_cq_event()
136 if (atomic_dec_and_test(&cq->refcount)) in mlx4_cq_event()
137 complete(&cq->free); in mlx4_cq_event()
163 int mlx4_cq_modify(struct mlx4_dev *dev, struct mlx4_cq *cq, in mlx4_cq_modify() argument
178 err = mlx4_MODIFY_CQ(dev, mailbox, cq->cqn, 1); in mlx4_cq_modify()
185 int mlx4_cq_resize(struct mlx4_dev *dev, struct mlx4_cq *cq, in mlx4_cq_resize() argument
204 err = mlx4_MODIFY_CQ(dev, mailbox, cq->cqn, 0); in mlx4_cq_resize()
285 struct mlx4_cq *cq, unsigned vector, int collapsed, in mlx4_cq_alloc() argument
298 cq->vector = vector; in mlx4_cq_alloc()
300 err = mlx4_cq_alloc_icm(dev, &cq->cqn); in mlx4_cq_alloc()
305 err = radix_tree_insert(&cq_table->tree, cq->cqn, cq); in mlx4_cq_alloc()
330 err = mlx4_SW2HW_CQ(dev, mailbox, cq->cqn); in mlx4_cq_alloc()
335 cq->cons_index = 0; in mlx4_cq_alloc()
336 cq->arm_sn = 1; in mlx4_cq_alloc()
337 cq->uar = uar; in mlx4_cq_alloc()
338 atomic_set(&cq->refcount, 1); in mlx4_cq_alloc()
339 init_completion(&cq->free); in mlx4_cq_alloc()
340 cq->comp = mlx4_add_cq_to_tasklet; in mlx4_cq_alloc()
341 cq->tasklet_ctx.priv = in mlx4_cq_alloc()
342 &priv->eq_table.eq[cq->vector].tasklet_ctx; in mlx4_cq_alloc()
343 INIT_LIST_HEAD(&cq->tasklet_ctx.list); in mlx4_cq_alloc()
346 cq->irq = priv->eq_table.eq[cq->vector].irq; in mlx4_cq_alloc()
351 radix_tree_delete(&cq_table->tree, cq->cqn); in mlx4_cq_alloc()
355 mlx4_cq_free_icm(dev, cq->cqn); in mlx4_cq_alloc()
361 void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq) in mlx4_cq_free() argument
367 err = mlx4_HW2SW_CQ(dev, NULL, cq->cqn); in mlx4_cq_free()
369 mlx4_warn(dev, "HW2SW_CQ failed (%d) for CQN %06x\n", err, cq->cqn); in mlx4_cq_free()
371 synchronize_irq(priv->eq_table.eq[cq->vector].irq); in mlx4_cq_free()
374 radix_tree_delete(&cq_table->tree, cq->cqn); in mlx4_cq_free()
377 if (atomic_dec_and_test(&cq->refcount)) in mlx4_cq_free()
378 complete(&cq->free); in mlx4_cq_free()
379 wait_for_completion(&cq->free); in mlx4_cq_free()
381 mlx4_cq_free_icm(dev, cq->cqn); in mlx4_cq_free()