lib/idxd: add support for new opcode to low level library (copy + CRC)
Upcoming patches will add support to the accel fw, the idxd engine and the accel_perf tool. Also following will come vectored support and batch versions. Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: Ie0fbd4b8da9f727426000898c0b511587adac65b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8139 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
ab5cc9dd6e
commit
1076008e63
@ -18,6 +18,8 @@ Updated DPDK submodule to DPDK 21.02.
|
||||
Remove the probe_cb parameter in spdk_idxd_probe function. And remove the definition
|
||||
of spdk_idxd_probe_cb function pointer. It should be implemented in idxd_user.c.
|
||||
|
||||
Added API `spdk_idxd_submit_copy_crc32c` to perform a CRC32C while copying data.
|
||||
|
||||
### util
|
||||
|
||||
`spdk_crc32c_iov_update` function was added to support calculating the crc32c of the
|
||||
|
@ -374,6 +374,28 @@ int spdk_idxd_submit_crc32c(struct spdk_idxd_io_channel *chan, uint32_t *dst, vo
|
||||
uint32_t seed, uint64_t nbytes,
|
||||
spdk_idxd_req_cb cb_fn, void *cb_arg);
|
||||
|
||||
/**
|
||||
* Build and submit a copy combined with CRC32-C request.
|
||||
*
|
||||
* This function will build the descriptor for copy plus CRC32-C and then immediately
|
||||
* submit by writing to the proper device portal.
|
||||
*
|
||||
* \param chan IDXD channel to submit request.
|
||||
* \param dst Destination virtual address.
|
||||
* \param src Source virtual address.
|
||||
* \param crc_dst Resulting calculation.
|
||||
* \param seed Four byte CRC-32C seed value.
|
||||
* \param nbytes Number of bytes to calculate on.
|
||||
* \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 cb_arg parameter
|
||||
* in the completion callback.
|
||||
*
|
||||
* \return 0 on success, negative errno on failure.
|
||||
*/
|
||||
int spdk_idxd_submit_copy_crc32c(struct spdk_idxd_io_channel *chan, void *dst, void *src,
|
||||
uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
|
||||
spdk_idxd_req_cb cb_fn, void *cb_arg);
|
||||
|
||||
/**
|
||||
* Check for completed requests on an IDXD channel.
|
||||
*
|
||||
|
@ -637,6 +637,47 @@ spdk_idxd_submit_crc32c(struct spdk_idxd_io_channel *chan, uint32_t *dst, void *
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
spdk_idxd_submit_copy_crc32c(struct spdk_idxd_io_channel *chan, void *dst, void *src,
|
||||
uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
|
||||
spdk_idxd_req_cb cb_fn, void *cb_arg)
|
||||
{
|
||||
struct idxd_hw_desc *desc;
|
||||
struct idxd_comp *comp;
|
||||
uint64_t src_addr, dst_addr;
|
||||
int rc;
|
||||
|
||||
/* Common prep. */
|
||||
rc = _idxd_prep_command(chan, cb_fn, cb_arg, &desc, &comp);
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = _vtophys(src, &src_addr, nbytes);
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = _vtophys(dst, &dst_addr, nbytes);
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Command specific. */
|
||||
desc->opcode = IDXD_OPCODE_COPY_CRC;
|
||||
desc->dst_addr = dst_addr;
|
||||
desc->src_addr = src_addr;
|
||||
desc->flags &= IDXD_CLEAR_CRC_FLAGS;
|
||||
desc->crc32c.seed = seed;
|
||||
desc->xfer_size = nbytes;
|
||||
comp->crc_dst = crc_dst;
|
||||
|
||||
/* Submit operation. */
|
||||
movdir64b(chan->portal, desc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_idxd_batch_get_max(void)
|
||||
{
|
||||
@ -1046,6 +1087,7 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
|
||||
SPDK_DEBUGLOG(idxd, "Complete batch %p\n", comp_ctx->batch);
|
||||
break;
|
||||
case IDXD_OPCODE_CRC32C_GEN:
|
||||
case IDXD_OPCODE_COPY_CRC:
|
||||
*(uint32_t *)comp_ctx->crc_dst = comp_ctx->hw.crc32c_val;
|
||||
*(uint32_t *)comp_ctx->crc_dst ^= ~0;
|
||||
break;
|
||||
|
@ -19,6 +19,7 @@
|
||||
spdk_idxd_set_config;
|
||||
spdk_idxd_submit_compare;
|
||||
spdk_idxd_submit_crc32c;
|
||||
spdk_idxd_submit_copy_crc32c;
|
||||
spdk_idxd_submit_copy;
|
||||
spdk_idxd_submit_dualcast;
|
||||
spdk_idxd_submit_fill;
|
||||
|
Loading…
Reference in New Issue
Block a user