lib/accel: add output_size to decompress API
We had it for compress but simply didn't think of a use case for decompress. During the develpoment of the compressdev accel_fw module it was discovered that compressdev does indeed provide the uncompressed length on completion of decompress and the reducelib uses it. So, add it here. Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: I2f6a8bbbe3ef8ebe0b50d6434845f405afa7d37d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16035 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
parent
8222c5bae3
commit
91f3063b14
@ -457,7 +457,7 @@ _submit_single(struct worker_thread *worker, struct ap_task *task)
|
||||
task->src_iovs = task->cur_seg->compressed_iovs;
|
||||
task->src_iovcnt = task->cur_seg->compressed_iovcnt;
|
||||
rc = spdk_accel_submit_decompress(worker->ch, task->dst_iovs, task->dst_iovcnt, task->src_iovs,
|
||||
task->src_iovcnt, flags, accel_done, task);
|
||||
task->src_iovcnt, NULL, flags, accel_done, task);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
|
@ -262,7 +262,7 @@ int spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst, struct
|
||||
* \param nbytes Length in bytes.
|
||||
* \param src_iovs The io vector array which stores the src data and len.
|
||||
* \param src_iovcnt The size of the src io vectors.
|
||||
* \param output_size The size of the compressed data
|
||||
* \param output_size The size of the compressed data (may be NULL if not desired)
|
||||
* \param flags Flags, optional flags that can vary per operation.
|
||||
* \param cb_fn Callback function which will be called when the request is complete.
|
||||
* \param cb_arg Opaque value which will be passed back as the arg parameter in
|
||||
@ -285,6 +285,7 @@ int spdk_accel_submit_compress(struct spdk_io_channel *ch, void *dst,
|
||||
* \param dst_iovcnt The size of the dst io vectors.
|
||||
* \param src_iovs The io vector array which stores the src data and len.
|
||||
* \param src_iovcnt The size of the src io vectors.
|
||||
* \param output_size The size of the compressed data (may be NULL if not desired)
|
||||
* \param flags Flags, optional flags that can vary per operation.
|
||||
* \param cb_fn Callback function which will be called when the request is complete.
|
||||
* \param cb_arg Opaque value which will be passed back as the arg parameter in
|
||||
@ -294,7 +295,7 @@ int spdk_accel_submit_compress(struct spdk_io_channel *ch, void *dst,
|
||||
*/
|
||||
int spdk_accel_submit_decompress(struct spdk_io_channel *ch, struct iovec *dst_iovs,
|
||||
size_t dst_iovcnt, struct iovec *src_iovs,
|
||||
size_t src_iovcnt, int flags,
|
||||
size_t src_iovcnt, uint32_t *output_size, int flags,
|
||||
spdk_accel_completion_cb cb_fn, void *cb_arg);
|
||||
|
||||
/** Object grouping multiple accel operations to be executed at the same point in time */
|
||||
|
@ -597,7 +597,8 @@ spdk_accel_submit_compress(struct spdk_io_channel *ch, void *dst, uint64_t nbyte
|
||||
int
|
||||
spdk_accel_submit_decompress(struct spdk_io_channel *ch, struct iovec *dst_iovs,
|
||||
size_t dst_iovcnt, struct iovec *src_iovs, size_t src_iovcnt,
|
||||
int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
|
||||
uint32_t *output_size, int flags, spdk_accel_completion_cb cb_fn,
|
||||
void *cb_arg)
|
||||
{
|
||||
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
|
||||
struct spdk_accel_task *accel_task;
|
||||
@ -609,6 +610,7 @@ spdk_accel_submit_decompress(struct spdk_io_channel *ch, struct iovec *dst_iovs,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
accel_task->output_size = output_size;
|
||||
accel_task->s.iovs = src_iovs;
|
||||
accel_task->s.iovcnt = src_iovcnt;
|
||||
accel_task->d.iovs = dst_iovs;
|
||||
@ -902,6 +904,8 @@ spdk_accel_append_decompress(struct spdk_accel_sequence **pseq, struct spdk_io_c
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* TODO: support output_size for chaining */
|
||||
task->output_size = NULL;
|
||||
task->dst_domain = dst_domain;
|
||||
task->dst_domain_ctx = dst_domain_ctx;
|
||||
task->d.iovs = dst_iovs;
|
||||
|
@ -358,6 +358,12 @@ _sw_accel_decompress(struct sw_accel_io_channel *sw_ch, struct spdk_accel_task *
|
||||
} while (sw_ch->state.block_state < ISAL_BLOCK_FINISH);
|
||||
assert(sw_ch->state.avail_in == 0);
|
||||
|
||||
/* Get our total output size */
|
||||
if (accel_task->output_size != NULL) {
|
||||
assert(sw_ch->state.total_out > 0);
|
||||
*accel_task->output_size = sw_ch->state.total_out;
|
||||
}
|
||||
|
||||
return rc;
|
||||
#else
|
||||
SPDK_ERRLOG("ISAL option is required to use software decompression.\n");
|
||||
|
@ -584,7 +584,7 @@ comp_dev_poller(void *args)
|
||||
status = deq_ops[i]->status;
|
||||
|
||||
if (spdk_likely(status == RTE_COMP_OP_STATUS_SUCCESS)) {
|
||||
if (task->op_code == ACCEL_OPC_COMPRESS) {
|
||||
if (task->output_size != NULL) {
|
||||
*task->output_size = deq_ops[i]->produced;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user