From: mrhines@linux.vnet.ibm.com
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, mst@redhat.com, owasserm@redhat.com,
abali@us.ibm.com, mrhines@us.ibm.com, gokul@us.ibm.com,
pbonzini@redhat.com
Subject: [Qemu-devel] [RFC PATCH RDMA support v5: 06/12] connection-establishment for RDMA
Date: Mon, 8 Apr 2013 23:04:35 -0400 [thread overview]
Message-ID: <1365476681-31593-7-git-send-email-mrhines@linux.vnet.ibm.com> (raw)
In-Reply-To: <1365476681-31593-1-git-send-email-mrhines@linux.vnet.ibm.com>
From: "Michael R. Hines" <mrhines@us.ibm.com>
Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
---
migration-rdma.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 121 insertions(+)
create mode 100644 migration-rdma.c
diff --git a/migration-rdma.c b/migration-rdma.c
new file mode 100644
index 0000000..2a0becd
--- /dev/null
+++ b/migration-rdma.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2013 Michael R. Hines <mrhines@us.ibm.com>
+ * Copyright (C) 2010 Jiuxing Liu <jl@us.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; under version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#include "migration/rdma.h"
+#include "qemu-common.h"
+#include "migration/migration.h"
+#include "migration/qemu-file.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+#include <string.h>
+
+//#define DEBUG_MIGRATION_RDMA
+
+#ifdef DEBUG_MIGRATION_RDMA
+#define DPRINTF(fmt, ...) \
+ do { printf("migration-rdma: " fmt, ## __VA_ARGS__); } while (0)
+#else
+#define DPRINTF(fmt, ...) \
+ do { } while (0)
+#endif
+
+static void rdma_accept_incoming_migration(void *opaque)
+{
+ int ret;
+ QEMUFile *f;
+
+ DPRINTF("Accepting rdma connection...\n");
+
+ if ((ret = qemu_rdma_accept(opaque))) {
+ fprintf(stderr, "RDMA Migration initialization failed!\n");
+ goto err;
+ }
+
+ DPRINTF("Accepted migration\n");
+
+ f = qemu_fopen_rdma(opaque, "rb");
+ if (f == NULL) {
+ fprintf(stderr, "could not qemu_fopen_rdma!\n");
+ goto err;
+ }
+
+ process_incoming_migration(f);
+ return;
+
+err:
+ qemu_rdma_cleanup(opaque);
+}
+
+void rdma_start_incoming_migration(const char * host_port, Error **errp)
+{
+ int ret;
+ void *opaque;
+
+ DPRINTF("Starting RDMA-based incoming migration\n");
+
+ if ((opaque = qemu_rdma_data_init(host_port, errp)) == NULL) {
+ return;
+ }
+
+ ret = qemu_rdma_server_init(opaque, NULL);
+
+ if (!ret) {
+ DPRINTF("qemu_rdma_server_init success\n");
+ ret = qemu_rdma_server_prepare(opaque, NULL);
+
+ if (!ret) {
+ DPRINTF("qemu_rdma_server_prepare success\n");
+
+ qemu_set_fd_handler2(qemu_rdma_get_fd(opaque), NULL,
+ rdma_accept_incoming_migration, NULL,
+ (void *)(intptr_t) opaque);
+ return;
+ }
+ }
+
+ g_free(opaque);
+}
+
+void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp)
+{
+ MigrationState *s = opaque;
+ void *rdma_opaque = NULL;
+ int ret;
+
+ if ((rdma_opaque = qemu_rdma_data_init(host_port, errp)) == NULL)
+ return;
+
+ ret = qemu_rdma_client_init(rdma_opaque, NULL,
+ s->enabled_capabilities[MIGRATION_CAPABILITY_CHUNK_REGISTER_DESTINATION]);
+
+ if(!ret) {
+ DPRINTF("qemu_rdma_client_init success\n");
+ ret = qemu_rdma_connect(rdma_opaque, NULL);
+
+ if(!ret) {
+ s->file = qemu_fopen_rdma(rdma_opaque, "wb");
+ DPRINTF("qemu_rdma_client_connect success\n");
+ migrate_fd_connect(s);
+ return;
+ }
+ }
+
+ g_free(rdma_opaque);
+ migrate_fd_error(s);
+}
--
1.7.10.4
next prev parent reply other threads:[~2013-04-09 3:05 UTC|newest]
Thread overview: 97+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-09 3:04 [Qemu-devel] [RFC PATCH RDMA support v5: 00/12] new formal protocol design mrhines
2013-04-09 3:04 ` [Qemu-devel] [RFC PATCH RDMA support v5: 01/12] ./configure with and without --enable-rdma mrhines
2013-04-09 17:05 ` Paolo Bonzini
2013-04-09 18:07 ` Michael R. Hines
2013-04-09 3:04 ` [Qemu-devel] [RFC PATCH RDMA support v5: 02/12] check for CONFIG_RDMA mrhines
2013-04-09 16:46 ` Paolo Bonzini
2013-04-09 3:04 ` [Qemu-devel] [RFC PATCH RDMA support v5: 03/12] comprehensive protocol documentation mrhines
2013-04-10 5:27 ` Michael S. Tsirkin
2013-04-10 13:04 ` Michael R. Hines
2013-04-10 13:34 ` Michael S. Tsirkin
2013-04-10 15:29 ` Michael R. Hines
2013-04-10 17:41 ` Michael S. Tsirkin
2013-04-10 20:05 ` Michael R. Hines
2013-04-11 7:19 ` Michael S. Tsirkin
2013-04-11 13:12 ` Michael R. Hines
2013-04-11 13:48 ` Michael S. Tsirkin
2013-04-11 13:58 ` Michael R. Hines
2013-04-11 14:37 ` Michael S. Tsirkin
2013-04-11 14:50 ` Paolo Bonzini
2013-04-11 14:56 ` Michael S. Tsirkin
2013-04-11 17:49 ` Michael R. Hines
2013-04-11 19:15 ` Michael S. Tsirkin
2013-04-11 20:33 ` Michael R. Hines
2013-04-12 10:48 ` Michael S. Tsirkin
2013-04-12 10:53 ` Paolo Bonzini
2013-04-12 11:25 ` Michael S. Tsirkin
2013-04-12 14:43 ` Paolo Bonzini
2013-04-14 11:59 ` Michael S. Tsirkin
2013-04-14 14:09 ` Paolo Bonzini
2013-04-14 14:40 ` Michael R. Hines
2013-04-14 14:27 ` Michael R. Hines
2013-04-14 16:03 ` Michael S. Tsirkin
2013-04-14 16:07 ` Michael R. Hines
2013-04-14 16:40 ` Michael R. Hines
2013-04-14 18:30 ` Michael S. Tsirkin
2013-04-14 19:06 ` Michael R. Hines
2013-04-14 21:10 ` Michael S. Tsirkin
2013-04-15 1:06 ` Michael R. Hines
2013-04-15 6:00 ` Michael S. Tsirkin
2013-04-15 13:07 ` Michael R. Hines
2013-04-15 22:20 ` Michael S. Tsirkin
2013-04-15 8:28 ` Paolo Bonzini
2013-04-15 13:08 ` Michael R. Hines
2013-04-15 8:26 ` Paolo Bonzini
2013-04-12 13:47 ` Michael R. Hines
2013-04-14 8:28 ` Michael S. Tsirkin
2013-04-14 14:31 ` Michael R. Hines
2013-04-14 18:51 ` Michael S. Tsirkin
2013-04-14 19:43 ` Michael R. Hines
2013-04-14 21:16 ` Michael S. Tsirkin
2013-04-15 1:10 ` Michael R. Hines
2013-04-15 6:10 ` Michael S. Tsirkin
2013-04-15 8:34 ` Paolo Bonzini
2013-04-15 13:24 ` Michael R. Hines
2013-04-15 13:30 ` Paolo Bonzini
2013-04-15 19:55 ` Michael R. Hines
2013-04-11 15:01 ` Michael R. Hines
2013-04-11 15:18 ` Michael R. Hines
2013-04-11 15:33 ` Paolo Bonzini
2013-04-11 15:46 ` Michael S. Tsirkin
2013-04-11 15:47 ` Paolo Bonzini
2013-04-11 15:58 ` Michael S. Tsirkin
2013-04-11 16:06 ` Michael R. Hines
2013-04-12 5:10 ` Michael R. Hines
2013-04-12 5:26 ` Paolo Bonzini
2013-04-12 5:54 ` Michael R. Hines
2013-04-11 15:44 ` Michael S. Tsirkin
2013-04-11 16:09 ` Michael R. Hines
2013-04-11 17:04 ` Michael S. Tsirkin
2013-04-11 17:27 ` Michael R. Hines
2013-04-11 16:13 ` Michael R. Hines
2013-04-09 3:04 ` [Qemu-devel] [RFC PATCH RDMA support v5: 04/12] introduce qemu_ram_foreach_block() mrhines
2013-04-09 3:04 ` [Qemu-devel] [RFC PATCH RDMA support v5: 05/12] core RDMA migration logic w/ new protocol mrhines
2013-04-09 16:57 ` Paolo Bonzini
2013-04-09 3:04 ` mrhines [this message]
2013-04-09 3:04 ` [Qemu-devel] [RFC PATCH RDMA support v5: 07/12] additional savevm.c accessors for RDMA mrhines
2013-04-09 17:03 ` Paolo Bonzini
2013-04-09 17:31 ` Peter Maydell
2013-04-09 18:04 ` Michael R. Hines
2013-04-09 3:04 ` [Qemu-devel] [RFC PATCH RDMA support v5: 08/12] new capabilities added and check for QMP string 'rdma' mrhines
2013-04-09 17:01 ` Paolo Bonzini
2013-04-10 1:11 ` Michael R. Hines
2013-04-10 8:07 ` Paolo Bonzini
2013-04-10 10:35 ` Michael S. Tsirkin
2013-04-10 12:24 ` Michael R. Hines
2013-04-09 17:02 ` Paolo Bonzini
2013-04-09 3:04 ` [Qemu-devel] [RFC PATCH RDMA support v5: 09/12] transmit pc.ram using RDMA mrhines
2013-04-09 16:50 ` Paolo Bonzini
2013-04-09 3:04 ` [Qemu-devel] [RFC PATCH RDMA support v5: 10/12] new header file prototypes for savevm.c mrhines
2013-04-09 16:43 ` Paolo Bonzini
2013-04-09 3:04 ` [Qemu-devel] [RFC PATCH RDMA support v5: 11/12] update schema to define new capabilities mrhines
2013-04-09 16:43 ` Paolo Bonzini
2013-04-09 3:04 ` [Qemu-devel] [RFC PATCH RDMA support v5: 12/12] don't set nonblock on invalid file descriptor mrhines
2013-04-09 16:45 ` Paolo Bonzini
2013-04-09 4:24 ` [Qemu-devel] [RFC PATCH RDMA support v5: 00/12] new formal protocol design Michael R. Hines
2013-04-09 12:44 ` Michael S. Tsirkin
2013-04-09 14:23 ` Michael R. Hines
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1365476681-31593-7-git-send-email-mrhines@linux.vnet.ibm.com \
--to=mrhines@linux.vnet.ibm.com \
--cc=abali@us.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=gokul@us.ibm.com \
--cc=mrhines@us.ibm.com \
--cc=mst@redhat.com \
--cc=owasserm@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).