xref: /qemu/migration/rdma.h (revision 8ed7c0b6488a7f20318d6ba414f1cbcd0ed92afe)
1 /*
2  * RDMA protocol and interfaces
3  *
4  * Copyright IBM, Corp. 2010-2013
5  * Copyright Red Hat, Inc. 2015-2016
6  *
7  * Authors:
8  *  Michael R. Hines <mrhines@us.ibm.com>
9  *  Jiuxing Liu <jl@us.ibm.com>
10  *  Daniel P. Berrange <berrange@redhat.com>
11  *
12  * This work is licensed under the terms of the GNU GPL, version 2 or
13  * later.  See the COPYING file in the top-level directory.
14  *
15  */
16 
17 #include "qemu/sockets.h"
18 
19 #ifndef QEMU_MIGRATION_RDMA_H
20 #define QEMU_MIGRATION_RDMA_H
21 
22 #include "system/memory.h"
23 
24 void rdma_start_outgoing_migration(void *opaque, InetSocketAddress *host_port,
25                                    Error **errp);
26 
27 void rdma_start_incoming_migration(InetSocketAddress *host_port, Error **errp);
28 
29 /*
30  * Constants used by rdma return codes
31  */
32 #define RAM_CONTROL_SETUP     0
33 #define RAM_CONTROL_ROUND     1
34 #define RAM_CONTROL_FINISH    3
35 
36 #define RAM_SAVE_CONTROL_DELAYED  -2000
37 
38 #ifdef CONFIG_RDMA
39 int rdma_registration_handle(QEMUFile *f);
40 int rdma_registration_start(QEMUFile *f, uint64_t flags);
41 int rdma_registration_stop(QEMUFile *f, uint64_t flags);
42 int rdma_block_notification_handle(QEMUFile *f, const char *name);
43 int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset,
44                            ram_addr_t offset, size_t size);
45 #else
46 static inline
47 int rdma_registration_handle(QEMUFile *f) { return 0; }
48 static inline
49 int rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; }
50 static inline
51 int rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; }
52 static inline
53 int rdma_block_notification_handle(QEMUFile *f, const char *name) { return 0; }
54 static inline
55 int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset,
56                            ram_addr_t offset, size_t size)
57 {
58     g_assert_not_reached();
59 }
60 #endif
61 #endif
62