Lines Matching refs:cq

82 static void mlx4_add_cq_to_tasklet(struct mlx4_cq *cq)  in mlx4_add_cq_to_tasklet()  argument
84 struct mlx4_eq_tasklet *tasklet_ctx = cq->tasklet_ctx.priv; in mlx4_add_cq_to_tasklet()
94 if (list_empty_careful(&cq->tasklet_ctx.list)) { in mlx4_add_cq_to_tasklet()
95 refcount_inc(&cq->refcount); in mlx4_add_cq_to_tasklet()
97 list_add_tail(&cq->tasklet_ctx.list, &tasklet_ctx->list); in mlx4_add_cq_to_tasklet()
106 struct mlx4_cq *cq; in mlx4_cq_completion() local
109 cq = radix_tree_lookup(&mlx4_priv(dev)->cq_table.tree, in mlx4_cq_completion()
113 if (!cq) { in mlx4_cq_completion()
121 ++cq->arm_sn; in mlx4_cq_completion()
123 cq->comp(cq); in mlx4_cq_completion()
129 struct mlx4_cq *cq; in mlx4_cq_event() local
132 cq = radix_tree_lookup(&cq_table->tree, cqn & (dev->caps.num_cqs - 1)); in mlx4_cq_event()
135 if (!cq) { in mlx4_cq_event()
143 cq->event(cq, event_type); in mlx4_cq_event()
169 int mlx4_cq_modify(struct mlx4_dev *dev, struct mlx4_cq *cq, in mlx4_cq_modify() argument
184 err = mlx4_MODIFY_CQ(dev, mailbox, cq->cqn, 1); in mlx4_cq_modify()
191 int mlx4_cq_resize(struct mlx4_dev *dev, struct mlx4_cq *cq, in mlx4_cq_resize() argument
210 err = mlx4_MODIFY_CQ(dev, mailbox, cq->cqn, 0); in mlx4_cq_resize()
344 struct mlx4_cq *cq, unsigned vector, int collapsed, in mlx4_cq_alloc() argument
358 cq->vector = vector; in mlx4_cq_alloc()
360 err = mlx4_cq_alloc_icm(dev, &cq->cqn, cq->usage); in mlx4_cq_alloc()
365 err = radix_tree_insert(&cq_table->tree, cq->cqn, cq); in mlx4_cq_alloc()
404 err = mlx4_SW2HW_CQ(dev, mailbox, cq->cqn, sw_cq_init); in mlx4_cq_alloc()
410 cq->cons_index = 0; in mlx4_cq_alloc()
411 cq->arm_sn = 1; in mlx4_cq_alloc()
412 cq->uar = uar; in mlx4_cq_alloc()
413 refcount_set(&cq->refcount, 1); in mlx4_cq_alloc()
414 init_completion(&cq->free); in mlx4_cq_alloc()
415 cq->comp = mlx4_add_cq_to_tasklet; in mlx4_cq_alloc()
416 cq->tasklet_ctx.priv = in mlx4_cq_alloc()
418 INIT_LIST_HEAD(&cq->tasklet_ctx.list); in mlx4_cq_alloc()
421 cq->irq = priv->eq_table.eq[MLX4_CQ_TO_EQ_VECTOR(vector)].irq; in mlx4_cq_alloc()
426 radix_tree_delete(&cq_table->tree, cq->cqn); in mlx4_cq_alloc()
430 mlx4_cq_free_icm(dev, cq->cqn); in mlx4_cq_alloc()
436 void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq) in mlx4_cq_free() argument
442 err = mlx4_HW2SW_CQ(dev, NULL, cq->cqn); in mlx4_cq_free()
444 mlx4_warn(dev, "HW2SW_CQ failed (%d) for CQN %06x\n", err, cq->cqn); in mlx4_cq_free()
447 radix_tree_delete(&cq_table->tree, cq->cqn); in mlx4_cq_free()
450 synchronize_irq(priv->eq_table.eq[MLX4_CQ_TO_EQ_VECTOR(cq->vector)].irq); in mlx4_cq_free()
451 if (priv->eq_table.eq[MLX4_CQ_TO_EQ_VECTOR(cq->vector)].irq != in mlx4_cq_free()
455 if (refcount_dec_and_test(&cq->refcount)) in mlx4_cq_free()
456 complete(&cq->free); in mlx4_cq_free()
457 wait_for_completion(&cq->free); in mlx4_cq_free()
459 mlx4_cq_free_icm(dev, cq->cqn); in mlx4_cq_free()