+/*
+ * Create protection domain and completion queues
+ */
+static int qemu_rdma_alloc_pd_cq(RDMAContext *rdma)
+{
+ /* allocate pd */
+ rdma->pd = ibv_alloc_pd(rdma->verbs);
+ if (!rdma->pd) {
+ fprintf(stderr, "failed to allocate protection domain\n");
+ return -1;
+ }
+
+ /* create completion channel */
+ rdma->comp_channel = ibv_create_comp_channel(rdma->verbs);
+ if (!rdma->comp_channel) {
+ fprintf(stderr, "failed to allocate completion channel\n");
+ goto err_alloc_pd_cq;
+ }
+
+ qemu_set_nonblock(rdma->comp_channel->fd);
Again showing my lack of IB-fu, do you have to test for POLLOUT
somewhere too? Or does it just work?
@@ -121,7 +125,6 @@ void process_incoming_migration(QEMUFile *f)
Coroutine *co = qemu_coroutine_create(process_incoming_migration_co);
int fd = qemu_get_fd(f);
- assert(fd != -1);
qemu_set_nonblock(fd);
So in the end you are setting the fd to non-blocking. :)
Please add a get_fd implementation to QEMUFile that returns
rdma->comp_channel->fd, and leave the assertion in place. The fd will
be set twice to nonblocking, but that's ok.