@@ -32,6 +32,7 @@
#include "io/channel-file.h"
#include "io/channel-socket.h"
#include "yank_functions.h"
+#include "rdma.h"
/* Multiple fd's */
@@ -793,6 +794,9 @@ static bool multifd_send_cleanup_channel(MultiFDSendParams *p, Error **errp)
static void multifd_send_cleanup_state(void)
{
file_cleanup_outgoing_migration();
+#ifdef CONFIG_RDMA
+ rdma_cleanup_outgoing_migration();
+#endif
socket_cleanup_outgoing_migration();
qemu_sem_destroy(&multifd_send_state->channels_created);
qemu_sem_destroy(&multifd_send_state->channels_ready);
@@ -1139,6 +1143,12 @@ static bool multifd_new_send_channel_create(gpointer opaque, Error **errp)
return file_send_channel_create(opaque, errp);
}
+#ifdef CONFIG_RDMA
+ if (rdma_send_channel_create(multifd_new_send_channel_async, opaque)) {
+ return true;
+ }
+#endif
+
socket_send_channel_create(multifd_new_send_channel_async, opaque);
return true;
}
@@ -19,6 +19,7 @@
#include "qapi/qapi-visit-sockets.h"
#include "channel.h"
#include "migration.h"
+#include "options.h"
#include "rdma.h"
#include "trace.h"
#include <stdio.h>
@@ -27,6 +28,28 @@ static struct RDMAOutgoingArgs {
InetSocketAddress *addr;
} outgoing_args;
+bool rdma_send_channel_create(QIOTaskFunc f, void *data)
+{
+ QIOChannelRDMA *rioc;
+
+ if (!outgoing_args.addr) {
+ return false;
+ }
+
+ rioc = qio_channel_rdma_new();
+ qio_channel_rdma_connect_async(rioc, outgoing_args.addr, f, data, NULL,
+ NULL);
+ return true;
+}
+
+void rdma_cleanup_outgoing_migration(void)
+{
+ if (outgoing_args.addr) {
+ qapi_free_InetSocketAddress(outgoing_args.addr);
+ outgoing_args.addr = NULL;
+ }
+}
+
static void rdma_outgoing_migration(QIOTask *task, gpointer opaque)
{
MigrationState *s = opaque;
@@ -74,6 +97,10 @@ void rdma_start_incoming_migration(InetSocketAddress *addr, Error **errp)
qio_channel_set_name(QIO_CHANNEL(rioc), "migration-rdma-listener");
+ if (migrate_multifd()) {
+ num = migrate_multifd_channels();
+ }
+
if (qio_channel_rdma_listen_sync(rioc, addr, num, errp) < 0) {
object_unref(OBJECT(rioc));
return;
@@ -16,6 +16,12 @@
#include "qemu/sockets.h"
+#include <stdbool.h>
+
+bool rdma_send_channel_create(QIOTaskFunc f, void *data);
+
+void rdma_cleanup_outgoing_migration(void);
+
void rdma_start_outgoing_migration(MigrationState *s, InetSocketAddress *addr,
Error **errp);