Lines Matching refs:p
114 static int multifd_uadk_send_setup(MultiFDSendParams *p, Error **errp) in multifd_uadk_send_setup() argument
118 wd = multifd_uadk_init_sess(p->page_count, p->page_size, true, errp); in multifd_uadk_send_setup()
123 p->compress_data = wd; in multifd_uadk_send_setup()
124 assert(p->iov == NULL); in multifd_uadk_send_setup()
131 p->iov = g_new0(struct iovec, p->page_count + 2); in multifd_uadk_send_setup()
143 static void multifd_uadk_send_cleanup(MultiFDSendParams *p, Error **errp) in multifd_uadk_send_cleanup() argument
145 struct wd_data *wd = p->compress_data; in multifd_uadk_send_cleanup()
148 p->compress_data = NULL; in multifd_uadk_send_cleanup()
149 g_free(p->iov); in multifd_uadk_send_cleanup()
150 p->iov = NULL; in multifd_uadk_send_cleanup()
153 static inline void prepare_next_iov(MultiFDSendParams *p, void *base, in prepare_next_iov() argument
156 p->iov[p->iovs_num].iov_base = (uint8_t *)base; in prepare_next_iov()
157 p->iov[p->iovs_num].iov_len = len; in prepare_next_iov()
158 p->next_packet_size += len; in prepare_next_iov()
159 p->iovs_num++; in prepare_next_iov()
173 static int multifd_uadk_send_prepare(MultiFDSendParams *p, Error **errp) in multifd_uadk_send_prepare() argument
175 struct wd_data *uadk_data = p->compress_data; in multifd_uadk_send_prepare()
180 if (!multifd_send_prepare_common(p)) { in multifd_uadk_send_prepare()
184 hdr_size = p->pages->normal_num * sizeof(uint32_t); in multifd_uadk_send_prepare()
186 prepare_next_iov(p, uadk_data->buf_hdr, hdr_size); in multifd_uadk_send_prepare()
188 for (int i = 0; i < p->pages->normal_num; i++) { in multifd_uadk_send_prepare()
191 .src = p->pages->block->host + p->pages->offset[i], in multifd_uadk_send_prepare()
192 .src_len = p->page_size, in multifd_uadk_send_prepare()
195 .dst_len = p->page_size * 2, in multifd_uadk_send_prepare()
202 p->id, ret, creq.status); in multifd_uadk_send_prepare()
205 if (creq.dst_len < p->page_size) { in multifd_uadk_send_prepare()
207 prepare_next_iov(p, buf, creq.dst_len); in multifd_uadk_send_prepare()
217 if (!uadk_data->handle || creq.dst_len >= p->page_size) { in multifd_uadk_send_prepare()
218 uadk_data->buf_hdr[i] = cpu_to_be32(p->page_size); in multifd_uadk_send_prepare()
219 prepare_next_iov(p, p->pages->block->host + p->pages->offset[i], in multifd_uadk_send_prepare()
220 p->page_size); in multifd_uadk_send_prepare()
221 buf += p->page_size; in multifd_uadk_send_prepare()
225 p->flags |= MULTIFD_FLAG_UADK; in multifd_uadk_send_prepare()
226 multifd_send_fill_packet(p); in multifd_uadk_send_prepare()
240 static int multifd_uadk_recv_setup(MultiFDRecvParams *p, Error **errp) in multifd_uadk_recv_setup() argument
244 wd = multifd_uadk_init_sess(p->page_count, p->page_size, false, errp); in multifd_uadk_recv_setup()
248 p->compress_data = wd; in multifd_uadk_recv_setup()
259 static void multifd_uadk_recv_cleanup(MultiFDRecvParams *p) in multifd_uadk_recv_cleanup() argument
261 struct wd_data *wd = p->compress_data; in multifd_uadk_recv_cleanup()
264 p->compress_data = NULL; in multifd_uadk_recv_cleanup()
278 static int multifd_uadk_recv(MultiFDRecvParams *p, Error **errp) in multifd_uadk_recv() argument
280 struct wd_data *uadk_data = p->compress_data; in multifd_uadk_recv()
281 uint32_t in_size = p->next_packet_size; in multifd_uadk_recv()
282 uint32_t flags = p->flags & MULTIFD_FLAG_COMPRESSION_MASK; in multifd_uadk_recv()
283 uint32_t hdr_len = p->normal_num * sizeof(uint32_t); in multifd_uadk_recv()
290 p->id, flags, MULTIFD_FLAG_ZLIB); in multifd_uadk_recv()
294 multifd_recv_zero_page_process(p); in multifd_uadk_recv()
295 if (!p->normal_num) { in multifd_uadk_recv()
302 ret = qio_channel_read_all(p->c, (void *) uadk_data->buf_hdr, in multifd_uadk_recv()
308 for (int i = 0; i < p->normal_num; i++) { in multifd_uadk_recv()
311 assert(uadk_data->buf_hdr[i] <= p->page_size); in multifd_uadk_recv()
316 ret = qio_channel_read_all(p->c, (void *)buf, data_len, errp); in multifd_uadk_recv()
321 for (int i = 0; i < p->normal_num; i++) { in multifd_uadk_recv()
326 .dst = p->host + p->normal[i], in multifd_uadk_recv()
327 .dst_len = p->page_size, in multifd_uadk_recv()
330 if (uadk_data->buf_hdr[i] == p->page_size) { in multifd_uadk_recv()
331 memcpy(p->host + p->normal[i], buf, p->page_size); in multifd_uadk_recv()
332 buf += p->page_size; in multifd_uadk_recv()
338 p->id); in multifd_uadk_recv()
345 p->id, ret, creq.status); in multifd_uadk_recv()
348 if (creq.dst_len != p->page_size) { in multifd_uadk_recv()
349 error_setg(errp, "multifd %u: decompressed length error", p->id); in multifd_uadk_recv()