};
};
+#define RS_RECV_WR_ID (~((uint64_t) 0))
+
/*
* rsocket states are ordered as passive, connecting, connected, disconnected.
*/
return -1;
}
+static inline int
+rs_post_recv(struct rsocket *rs)
+{
+ struct ibv_recv_wr wr, *bad;
+
+ wr.wr_id = RS_RECV_WR_ID;
+ wr.next = NULL;
+ wr.sg_list = NULL;
+ wr.num_sge = 0;
+
+ return rdma_seterrno(ibv_post_recv(rs->cm_id->qp, &wr, &bad));
+}
+
static int rs_create_ep(struct rsocket *rs)
{
struct ibv_qp_init_attr qp_attr;
return ret;
for (i = 0; i < rs->rq_size; i++) {
- ret = rdma_post_recvv(rs->cm_id, NULL, NULL, 0);
+ ret = rs_post_recv(rs);
if (ret)
return ret;
}
int ret, rcnt = 0;
while ((ret = ibv_poll_cq(rs->cm_id->recv_cq, 1, &wc)) > 0) {
- if (wc.opcode == IBV_WC_RECV_RDMA_WITH_IMM) {
+ if (wc.wr_id == RS_RECV_WR_ID) {
if (wc.status != IBV_WC_SUCCESS)
continue;
rcnt++;
if (rs->state & rs_connected) {
while (!ret && rcnt--)
- ret = rdma_post_recvv(rs->cm_id, NULL, NULL, 0);
+ ret = rs_post_recv(rs);
if (ret) {
rs->state = rs_error;
RS_CTRL_SHUTDOWN : RS_CTRL_DISCONNECT;
}
if (!rs_can_send_ctrl(rs)) {
+ printf(" rshutdown - need ctrl msg %d - %p\n", socket, rs);
ret = rs_process_cq(rs, 0, rs_can_send_ctrl);
+ printf(" rshutdown - have ctrl msg %d - %p\n", socket, rs);
if (ret)
return ret;
}