Lines Matching refs:cq

42 static void mlx4_en_cq_event(struct mlx4_cq *cq, enum mlx4_event event)  in mlx4_en_cq_event()  argument
58 struct mlx4_en_cq *cq; in mlx4_en_create_cq() local
61 cq = kzalloc_node(sizeof(*cq), GFP_KERNEL, node); in mlx4_en_create_cq()
62 if (!cq) { in mlx4_en_create_cq()
63 cq = kzalloc(sizeof(*cq), GFP_KERNEL); in mlx4_en_create_cq()
64 if (!cq) { in mlx4_en_create_cq()
70 cq->size = entries; in mlx4_en_create_cq()
71 cq->buf_size = cq->size * mdev->dev->caps.cqe_size; in mlx4_en_create_cq()
73 cq->tq = taskqueue_create_fast("mlx4_en_que", M_NOWAIT, in mlx4_en_create_cq()
74 taskqueue_thread_enqueue, &cq->tq); in mlx4_en_create_cq()
76 TASK_INIT(&cq->cq_task, 0, mlx4_en_rx_que, cq); in mlx4_en_create_cq()
77 taskqueue_start_threads(&cq->tq, 1, PI_NET, "%s rx cq", in mlx4_en_create_cq()
81 TASK_INIT(&cq->cq_task, 0, mlx4_en_tx_que, cq); in mlx4_en_create_cq()
82 taskqueue_start_threads(&cq->tq, 1, PI_NET, "%s tx cq", in mlx4_en_create_cq()
86 cq->ring = ring; in mlx4_en_create_cq()
87 cq->is_tx = mode; in mlx4_en_create_cq()
88 cq->vector = mdev->dev->caps.num_comp_vectors; in mlx4_en_create_cq()
89 spin_lock_init(&cq->lock); in mlx4_en_create_cq()
91 err = mlx4_alloc_hwq_res(mdev->dev, &cq->wqres, in mlx4_en_create_cq()
92 cq->buf_size, 2 * PAGE_SIZE); in mlx4_en_create_cq()
96 err = mlx4_en_map_buffer(&cq->wqres.buf); in mlx4_en_create_cq()
100 cq->buf = (struct mlx4_cqe *)cq->wqres.buf.direct.buf; in mlx4_en_create_cq()
101 *pcq = cq; in mlx4_en_create_cq()
106 mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size); in mlx4_en_create_cq()
108 kfree(cq); in mlx4_en_create_cq()
113 int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq, in mlx4_en_activate_cq() argument
121 cq->dev = mdev->pndev[priv->port]; in mlx4_en_activate_cq()
122 cq->mcq.set_ci_db = cq->wqres.db.db; in mlx4_en_activate_cq()
123 cq->mcq.arm_db = cq->wqres.db.db + 1; in mlx4_en_activate_cq()
124 *cq->mcq.set_ci_db = 0; in mlx4_en_activate_cq()
125 *cq->mcq.arm_db = 0; in mlx4_en_activate_cq()
126 memset(cq->buf, 0, cq->buf_size); in mlx4_en_activate_cq()
128 if (cq->is_tx == RX) { in mlx4_en_activate_cq()
130 cq->vector)) { in mlx4_en_activate_cq()
131 cq->vector = cq_idx % mdev->dev->caps.num_comp_vectors; in mlx4_en_activate_cq()
134 &cq->vector); in mlx4_en_activate_cq()
137 cq->vector); in mlx4_en_activate_cq()
151 cq->vector = rx_cq->vector; in mlx4_en_activate_cq()
154 if (!cq->is_tx) in mlx4_en_activate_cq()
155 cq->size = priv->rx_ring[cq->ring]->actual_size; in mlx4_en_activate_cq()
157 err = mlx4_cq_alloc(mdev->dev, cq->size, &cq->wqres.mtt, in mlx4_en_activate_cq()
158 &mdev->priv_uar, cq->wqres.db.dma, &cq->mcq, in mlx4_en_activate_cq()
159 cq->vector, 0, timestamp_en); in mlx4_en_activate_cq()
163 cq->mcq.comp = cq->is_tx ? mlx4_en_tx_irq : mlx4_en_rx_irq; in mlx4_en_activate_cq()
164 cq->mcq.event = mlx4_en_cq_event; in mlx4_en_activate_cq()
166 if (cq->is_tx) { in mlx4_en_activate_cq()
167 init_timer(&cq->timer); in mlx4_en_activate_cq()
168 cq->timer.function = mlx4_en_poll_tx_cq; in mlx4_en_activate_cq()
169 cq->timer.data = (unsigned long) cq; in mlx4_en_activate_cq()
177 mlx4_release_eq(mdev->dev, cq->vector); in mlx4_en_activate_cq()
178 cq->vector = mdev->dev->caps.num_comp_vectors; in mlx4_en_activate_cq()
185 struct mlx4_en_cq *cq = *pcq; in mlx4_en_destroy_cq() local
187 taskqueue_drain(cq->tq, &cq->cq_task); in mlx4_en_destroy_cq()
188 taskqueue_free(cq->tq); in mlx4_en_destroy_cq()
189 mlx4_en_unmap_buffer(&cq->wqres.buf); in mlx4_en_destroy_cq()
190 mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size); in mlx4_en_destroy_cq()
191 if (mlx4_is_eq_vector_valid(mdev->dev, priv->port, cq->vector) && in mlx4_en_destroy_cq()
192 cq->is_tx == RX) in mlx4_en_destroy_cq()
193 mlx4_release_eq(priv->mdev->dev, cq->vector); in mlx4_en_destroy_cq()
194 cq->vector = 0; in mlx4_en_destroy_cq()
195 cq->buf_size = 0; in mlx4_en_destroy_cq()
196 cq->buf = NULL; in mlx4_en_destroy_cq()
197 kfree(cq); in mlx4_en_destroy_cq()
201 void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq) in mlx4_en_deactivate_cq() argument
203 taskqueue_drain(cq->tq, &cq->cq_task); in mlx4_en_deactivate_cq()
204 if (!cq->is_tx) { in mlx4_en_deactivate_cq()
207 del_timer_sync(&cq->timer); in mlx4_en_deactivate_cq()
210 mlx4_cq_free(priv->mdev->dev, &cq->mcq); in mlx4_en_deactivate_cq()
214 int mlx4_en_set_cq_moder(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq) in mlx4_en_set_cq_moder() argument
216 return mlx4_cq_modify(priv->mdev->dev, &cq->mcq, in mlx4_en_set_cq_moder()
217 cq->moder_cnt, cq->moder_time); in mlx4_en_set_cq_moder()
220 int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq) in mlx4_en_arm_cq() argument
222 mlx4_cq_arm(&cq->mcq, MLX4_CQ_DB_REQ_NOT, priv->mdev->uar_map, in mlx4_en_arm_cq()