Lines Matching refs:cq

40 static void mlx4_en_cq_event(struct mlx4_cq *cq, enum mlx4_event event)  in mlx4_en_cq_event()  argument
52 struct mlx4_en_cq *cq; in mlx4_en_create_cq() local
55 cq = kzalloc_node(sizeof(*cq), GFP_KERNEL, node); in mlx4_en_create_cq()
56 if (!cq) { in mlx4_en_create_cq()
57 cq = kzalloc(sizeof(*cq), GFP_KERNEL); in mlx4_en_create_cq()
58 if (!cq) { in mlx4_en_create_cq()
64 cq->size = entries; in mlx4_en_create_cq()
65 cq->buf_size = cq->size * mdev->dev->caps.cqe_size; in mlx4_en_create_cq()
67 cq->ring = ring; in mlx4_en_create_cq()
68 cq->is_tx = mode; in mlx4_en_create_cq()
74 err = mlx4_alloc_hwq_res(mdev->dev, &cq->wqres, in mlx4_en_create_cq()
75 cq->buf_size, 2 * PAGE_SIZE); in mlx4_en_create_cq()
80 err = mlx4_en_map_buffer(&cq->wqres.buf); in mlx4_en_create_cq()
84 cq->buf = (struct mlx4_cqe *)cq->wqres.buf.direct.buf; in mlx4_en_create_cq()
85 *pcq = cq; in mlx4_en_create_cq()
90 mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size); in mlx4_en_create_cq()
92 kfree(cq); in mlx4_en_create_cq()
97 int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq, in mlx4_en_activate_cq() argument
111 cq->dev = mdev->pndev[priv->port]; in mlx4_en_activate_cq()
112 cq->mcq.set_ci_db = cq->wqres.db.db; in mlx4_en_activate_cq()
113 cq->mcq.arm_db = cq->wqres.db.db + 1; in mlx4_en_activate_cq()
114 *cq->mcq.set_ci_db = 0; in mlx4_en_activate_cq()
115 *cq->mcq.arm_db = 0; in mlx4_en_activate_cq()
116 memset(cq->buf, 0, cq->buf_size); in mlx4_en_activate_cq()
118 if (cq->is_tx == RX) { in mlx4_en_activate_cq()
120 if (!cq->vector) { in mlx4_en_activate_cq()
122 cq->ring); in mlx4_en_activate_cq()
125 &cq->vector)) { in mlx4_en_activate_cq()
126 cq->vector = (cq->ring + 1 + priv->port) in mlx4_en_activate_cq()
134 cq->vector = (cq->ring + 1 + priv->port) % in mlx4_en_activate_cq()
138 cq->irq_desc = in mlx4_en_activate_cq()
140 cq->vector)); in mlx4_en_activate_cq()
148 cq->vector = rx_cq->vector; in mlx4_en_activate_cq()
151 if (!cq->is_tx) in mlx4_en_activate_cq()
152 cq->size = priv->rx_ring[cq->ring]->actual_size; in mlx4_en_activate_cq()
154 if ((cq->is_tx && priv->hwtstamp_config.tx_type) || in mlx4_en_activate_cq()
155 (!cq->is_tx && priv->hwtstamp_config.rx_filter)) in mlx4_en_activate_cq()
158 err = mlx4_cq_alloc(mdev->dev, cq->size, &cq->wqres.mtt, in mlx4_en_activate_cq()
159 &mdev->priv_uar, cq->wqres.db.dma, &cq->mcq, in mlx4_en_activate_cq()
160 cq->vector, 0, timestamp_en); in mlx4_en_activate_cq()
164 cq->mcq.comp = cq->is_tx ? mlx4_en_tx_irq : mlx4_en_rx_irq; in mlx4_en_activate_cq()
165 cq->mcq.event = mlx4_en_cq_event; in mlx4_en_activate_cq()
167 if (cq->is_tx) { in mlx4_en_activate_cq()
168 netif_napi_add(cq->dev, &cq->napi, mlx4_en_poll_tx_cq, in mlx4_en_activate_cq()
171 struct mlx4_en_rx_ring *ring = priv->rx_ring[cq->ring]; in mlx4_en_activate_cq()
173 err = irq_set_affinity_hint(cq->mcq.irq, in mlx4_en_activate_cq()
178 netif_napi_add(cq->dev, &cq->napi, mlx4_en_poll_rx_cq, 64); in mlx4_en_activate_cq()
179 napi_hash_add(&cq->napi); in mlx4_en_activate_cq()
182 napi_enable(&cq->napi); in mlx4_en_activate_cq()
190 struct mlx4_en_cq *cq = *pcq; in mlx4_en_destroy_cq() local
192 mlx4_en_unmap_buffer(&cq->wqres.buf); in mlx4_en_destroy_cq()
193 mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size); in mlx4_en_destroy_cq()
194 if (priv->mdev->dev->caps.comp_pool && cq->vector) { in mlx4_en_destroy_cq()
195 mlx4_release_eq(priv->mdev->dev, cq->vector); in mlx4_en_destroy_cq()
197 cq->vector = 0; in mlx4_en_destroy_cq()
198 cq->buf_size = 0; in mlx4_en_destroy_cq()
199 cq->buf = NULL; in mlx4_en_destroy_cq()
200 kfree(cq); in mlx4_en_destroy_cq()
204 void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq) in mlx4_en_deactivate_cq() argument
206 napi_disable(&cq->napi); in mlx4_en_deactivate_cq()
207 if (!cq->is_tx) { in mlx4_en_deactivate_cq()
208 napi_hash_del(&cq->napi); in mlx4_en_deactivate_cq()
210 irq_set_affinity_hint(cq->mcq.irq, NULL); in mlx4_en_deactivate_cq()
212 netif_napi_del(&cq->napi); in mlx4_en_deactivate_cq()
214 mlx4_cq_free(priv->mdev->dev, &cq->mcq); in mlx4_en_deactivate_cq()
218 int mlx4_en_set_cq_moder(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq) in mlx4_en_set_cq_moder() argument
220 return mlx4_cq_modify(priv->mdev->dev, &cq->mcq, in mlx4_en_set_cq_moder()
221 cq->moder_cnt, cq->moder_time); in mlx4_en_set_cq_moder()
224 int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq) in mlx4_en_arm_cq() argument
226 mlx4_cq_arm(&cq->mcq, MLX4_CQ_DB_REQ_NOT, priv->mdev->uar_map, in mlx4_en_arm_cq()