diff options
author | Peter Xu <peterx@redhat.com> | 2024-02-02 18:28:46 +0800 |
---|---|---|
committer | Peter Xu <peterx@redhat.com> | 2024-02-05 14:42:10 +0800 |
commit | 452b205702335ddd45554aaf0eb37baf50bdfa00 (patch) | |
tree | 9c8eefe97fac0199e76864a2b2ee5c2e104a1647 /migration/multifd.h | |
parent | 8a9ef1738037e1d1132f9e1bd3e2f1102bde719f (diff) |
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.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/migration/multifd.h b/migration/multifd.h index 2e4ad0dc56..4ec005f53f 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 |