aboutsummaryrefslogtreecommitdiff
path: root/migration/multifd.h
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2024-02-02 18:28:46 +0800
committerPeter Xu <peterx@redhat.com>2024-02-05 14:42:10 +0800
commit452b205702335ddd45554aaf0eb37baf50bdfa00 (patch)
tree9c8eefe97fac0199e76864a2b2ee5c2e104a1647 /migration/multifd.h
parent8a9ef1738037e1d1132f9e1bd3e2f1102bde719f (diff)
downloadqemu-452b205702335ddd45554aaf0eb37baf50bdfa00.zip
qemu-452b205702335ddd45554aaf0eb37baf50bdfa00.tar.gz
qemu-452b205702335ddd45554aaf0eb37baf50bdfa00.tar.bz2
migration/multifd: multifd_send_prepare_header()
Introduce a helper multifd_send_prepare_header() to setup the header packet for multifd sender. It's fine to setup the IOV[0] _before_ send_prepare() because the packet buffer is already ready, even if the content is to be filled in. With this helper, we can already slightly clean up the zero copy path. Note that I explicitly put it into multifd.h, because I want it inlined directly into multifd*.c where necessary later. Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240202102857.110210-13-peterx@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration/multifd.h')
-rw-r--r--migration/multifd.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/migration/multifd.h b/migration/multifd.h
index 2e4ad0d..4ec005f 100644
--- a/migration/multifd.h
+++ b/migration/multifd.h
@@ -209,5 +209,13 @@ typedef struct {
void multifd_register_ops(int method, MultiFDMethods *ops);
+static inline void multifd_send_prepare_header(MultiFDSendParams *p)
+{
+ p->iov[0].iov_len = p->packet_len;
+ p->iov[0].iov_base = p->packet;
+ p->iovs_num++;
+}
+
+
#endif