Lines Matching refs:con

72 int rtrs_iu_post_recv(struct rtrs_con *con, struct rtrs_iu *iu)
74 struct rtrs_path *path = con->path;
83 rtrs_wrn(con->path,
93 return ib_post_recv(con->qp, &wr, NULL);
97 int rtrs_post_recv_empty(struct rtrs_con *con, struct ib_cqe *cqe)
105 return ib_post_recv(con->qp, &wr, NULL);
128 int rtrs_iu_post_send(struct rtrs_con *con, struct rtrs_iu *iu, size_t size,
131 struct rtrs_path *path = con->path;
150 return rtrs_post_send(con->qp, head, &wr, NULL);
154 int rtrs_iu_post_rdma_write_imm(struct rtrs_con *con, struct rtrs_iu *iu,
183 return rtrs_post_send(con->qp, head, &wr.wr, tail);
187 static int rtrs_post_rdma_write_imm_empty(struct rtrs_con *con,
193 struct rtrs_path *path = con->path;
196 atomic_dec_if_positive(&con->sq_wr_avail);
197 sflags = (atomic_inc_return(&con->wr_cnt) % path->signal_interval) ?
207 return rtrs_post_send(con->qp, head, &wr.wr, NULL);
212 struct rtrs_con *con = ctx;
216 rtrs_info(con->path, "QP event %s (%d) received\n",
218 rdma_notify(con->cm_id, IB_EVENT_COMM_EST);
221 rtrs_info(con->path, "Unhandled QP event %s (%d) received\n",
227 static bool is_pollqueue(struct rtrs_con *con)
229 return con->cid >= con->path->irq_con_num;
232 static int create_cq(struct rtrs_con *con, int cq_vector, int nr_cqe,
235 struct rdma_cm_id *cm_id = con->cm_id;
238 if (is_pollqueue(con))
239 cq = ib_alloc_cq(cm_id->device, con, nr_cqe, cq_vector,
245 rtrs_err(con->path, "Creating completion queue failed, errno: %pe\n",
249 con->cq = cq;
250 con->nr_cqe = nr_cqe;
255 static int create_qp(struct rtrs_con *con, struct ib_pd *pd,
259 struct rdma_cm_id *cm_id = con->cm_id;
266 init_attr.qp_context = con;
270 init_attr.send_cq = con->cq;
271 init_attr.recv_cq = con->cq;
276 rtrs_err(con->path, "Creating QP failed, err: %d\n", ret);
279 con->qp = cm_id->qp;
284 static void destroy_cq(struct rtrs_con *con)
286 if (con->cq) {
287 if (is_pollqueue(con))
288 ib_free_cq(con->cq);
290 ib_cq_pool_put(con->cq, con->nr_cqe);
292 con->cq = NULL;
295 int rtrs_cq_qp_create(struct rtrs_path *path, struct rtrs_con *con,
302 err = create_cq(con, cq_vector, nr_cqe, poll_ctx);
306 err = create_qp(con, path->dev->ib_pd, max_send_wr, max_recv_wr,
309 destroy_cq(con);
312 con->path = path;
318 void rtrs_cq_qp_destroy(struct rtrs_con *con)
320 if (con->qp) {
321 rdma_destroy_qp(con->cm_id);
322 con->qp = NULL;
324 destroy_cq(con);
336 struct rtrs_con *usr_con = path->con[0];
359 usr_con = path->con[0];
388 void (*err_handler)(struct rtrs_con *con),