Lines Matching refs:qpl
87 static void multifd_qpl_free_sw_job(QplData *qpl) in multifd_qpl_free_sw_job() argument
89 assert(qpl); in multifd_qpl_free_sw_job()
90 if (qpl->sw_job) { in multifd_qpl_free_sw_job()
91 qpl_fini_job(qpl->sw_job); in multifd_qpl_free_sw_job()
92 g_free(qpl->sw_job); in multifd_qpl_free_sw_job()
93 qpl->sw_job = NULL; in multifd_qpl_free_sw_job()
104 static void multifd_qpl_free_hw_job(QplData *qpl) in multifd_qpl_free_hw_job() argument
106 assert(qpl); in multifd_qpl_free_hw_job()
107 if (qpl->hw_jobs) { in multifd_qpl_free_hw_job()
108 for (int i = 0; i < qpl->page_num; i++) { in multifd_qpl_free_hw_job()
109 qpl_fini_job(qpl->hw_jobs[i].job); in multifd_qpl_free_hw_job()
110 g_free(qpl->hw_jobs[i].job); in multifd_qpl_free_hw_job()
111 qpl->hw_jobs[i].job = NULL; in multifd_qpl_free_hw_job()
113 g_free(qpl->hw_jobs); in multifd_qpl_free_hw_job()
114 qpl->hw_jobs = NULL; in multifd_qpl_free_hw_job()
126 static int multifd_qpl_init_sw_job(QplData *qpl, Error **errp) in multifd_qpl_init_sw_job() argument
145 qpl->sw_job = job; in multifd_qpl_init_sw_job()
158 static void multifd_qpl_init_hw_job(QplData *qpl, uint32_t size, Error **errp) in multifd_qpl_init_hw_job() argument
164 qpl->hw_jobs = g_new0(QplHwJob, qpl->page_num); in multifd_qpl_init_hw_job()
165 for (int i = 0; i < qpl->page_num; i++) { in multifd_qpl_init_hw_job()
170 qpl->hw_jobs[i].job = job; in multifd_qpl_init_hw_job()
188 QplData *qpl; in multifd_qpl_init() local
190 qpl = g_new0(QplData, 1); in multifd_qpl_init()
191 qpl->page_num = num; in multifd_qpl_init()
192 if (multifd_qpl_init_sw_job(qpl, errp) != 0) { in multifd_qpl_init()
193 g_free(qpl); in multifd_qpl_init()
196 qpl->hw_avail = check_hw_avail(&job_size); in multifd_qpl_init()
197 if (qpl->hw_avail) { in multifd_qpl_init()
198 multifd_qpl_init_hw_job(qpl, job_size, errp); in multifd_qpl_init()
200 qpl->zbuf = g_malloc0(size * num); in multifd_qpl_init()
201 qpl->zlen = g_new0(uint32_t, num); in multifd_qpl_init()
202 return qpl; in multifd_qpl_init()
212 static void multifd_qpl_deinit(QplData *qpl) in multifd_qpl_deinit() argument
214 if (qpl) { in multifd_qpl_deinit()
215 multifd_qpl_free_sw_job(qpl); in multifd_qpl_deinit()
216 multifd_qpl_free_hw_job(qpl); in multifd_qpl_deinit()
217 g_free(qpl->zbuf); in multifd_qpl_deinit()
218 g_free(qpl->zlen); in multifd_qpl_deinit()
219 g_free(qpl); in multifd_qpl_deinit()
235 QplData *qpl; in multifd_qpl_send_setup() local
237 qpl = multifd_qpl_init(p->page_count, p->page_size, errp); in multifd_qpl_send_setup()
238 if (!qpl) { in multifd_qpl_send_setup()
241 p->compress_data = qpl; in multifd_qpl_send_setup()
365 QplData *qpl = p->compress_data; in multifd_qpl_fill_packet() local
367 qpl->zlen[idx] = cpu_to_be32(len); in multifd_qpl_fill_packet()
406 QplData *qpl = p->compress_data; in multifd_qpl_compress_pages_slow_path() local
408 qpl_job *job = qpl->sw_job; in multifd_qpl_compress_pages_slow_path()
409 uint8_t *zbuf = qpl->zbuf; in multifd_qpl_compress_pages_slow_path()
436 QplData *qpl = p->compress_data; in multifd_qpl_compress_pages() local
445 zbuf = qpl->zbuf + (size * i); in multifd_qpl_compress_pages()
446 hw_job = &qpl->hw_jobs[i]; in multifd_qpl_compress_pages()
458 multifd_qpl_prepare_comp_job(qpl->sw_job, buf, zbuf, size); in multifd_qpl_compress_pages()
459 if (qpl_execute_job(qpl->sw_job) == QPL_STS_OK) { in multifd_qpl_compress_pages()
461 hw_job->sw_output_len = qpl->sw_job->total_out; in multifd_qpl_compress_pages()
471 zbuf = qpl->zbuf + (size * i); in multifd_qpl_compress_pages()
472 hw_job = &qpl->hw_jobs[i]; in multifd_qpl_compress_pages()
500 QplData *qpl = p->compress_data; in multifd_qpl_send_prepare() local
509 multifd_qpl_fill_iov(p, (uint8_t *) qpl->zlen, len); in multifd_qpl_send_prepare()
510 if (qpl->hw_avail) { in multifd_qpl_send_prepare()
534 QplData *qpl; in multifd_qpl_recv_setup() local
536 qpl = multifd_qpl_init(p->page_count, p->page_size, errp); in multifd_qpl_recv_setup()
537 if (!qpl) { in multifd_qpl_recv_setup()
540 p->compress_data = qpl; in multifd_qpl_recv_setup()
602 QplData *qpl = p->compress_data; in multifd_qpl_decompress_pages_slow_path() local
604 qpl_job *job = qpl->sw_job; in multifd_qpl_decompress_pages_slow_path()
605 uint8_t *zbuf = qpl->zbuf; in multifd_qpl_decompress_pages_slow_path()
610 len = qpl->zlen[i]; in multifd_qpl_decompress_pages_slow_path()
640 QplData *qpl = p->compress_data; in multifd_qpl_decompress_pages() local
642 uint8_t *zbuf = qpl->zbuf; in multifd_qpl_decompress_pages()
649 len = qpl->zlen[i]; in multifd_qpl_decompress_pages()
657 job = qpl->hw_jobs[i].job; in multifd_qpl_decompress_pages()
660 qpl->hw_jobs[i].fallback_sw_path = false; in multifd_qpl_decompress_pages()
668 qpl->hw_jobs[i].fallback_sw_path = true; in multifd_qpl_decompress_pages()
669 job = qpl->sw_job; in multifd_qpl_decompress_pages()
680 if (qpl->zlen[i] == size || qpl->hw_jobs[i].fallback_sw_path) { in multifd_qpl_decompress_pages()
684 job = qpl->hw_jobs[i].job; in multifd_qpl_decompress_pages()
704 QplData *qpl = p->compress_data; in multifd_qpl_recv() local
725 ret = qio_channel_read_all(p->c, (void *) qpl->zlen, len, errp); in multifd_qpl_recv()
730 qpl->zlen[i] = be32_to_cpu(qpl->zlen[i]); in multifd_qpl_recv()
731 assert(qpl->zlen[i] <= p->page_size); in multifd_qpl_recv()
732 zbuf_len += qpl->zlen[i]; in multifd_qpl_recv()
737 ret = qio_channel_read_all(p->c, (void *) qpl->zbuf, zbuf_len, errp); in multifd_qpl_recv()
742 if (qpl->hw_avail) { in multifd_qpl_recv()