Commit fe044f69 authored by paul luse's avatar paul luse Committed by Jim Harris
Browse files

lib/idxd: add raw request for low level testing



Provide an interface to allow the caller to provide a proprely
formatted descriptor.

Signed-off-by: default avatarpaul luse <paul.e.luse@intel.com>
Change-Id: I5c397761f556361040ec962d61169459150b6494
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12703


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 000ee408
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -333,6 +333,25 @@ int spdk_idxd_submit_decompress(struct spdk_idxd_io_channel *chan,
				struct iovec *siov, uint32_t siovcnt,
				int flags, spdk_idxd_req_cb cb_fn, void *cb_arg);

/**
 * Build and submit an IDXD raw request.
 *
 * This function will process the supplied descriptor and then immediately submit
 * by writing to the proper device portal.
 *
 * \param chan IDXD channel to submit request.
 * \param desc proprely formatted IDXD descriptor.  Memory addresses should be physical.
 * The completion address will be filled in by the lower level library.
 * \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
 * the completion callback.
 *
 * \return 0 on success, negative errno on failure.
 */
int spdk_idxd_submit_raw_desc(struct spdk_idxd_io_channel *chan,
			      struct idxd_hw_desc *desc,
			      spdk_idxd_req_cb cb_fn, void *cb_arg);

/**
 * Check for completed requests on an IDXD channel.
 *
+32 −0
Original line number Diff line number Diff line
@@ -1274,6 +1274,38 @@ spdk_idxd_submit_decompress(struct spdk_idxd_io_channel *chan,
	return -EINVAL;
}

int
spdk_idxd_submit_raw_desc(struct spdk_idxd_io_channel *chan,
			  struct idxd_hw_desc *_desc,
			  spdk_idxd_req_cb cb_fn, void *cb_arg)
{
	struct idxd_hw_desc *desc;
	struct idxd_ops *op;
	int rc, flags = 0;
	uint64_t comp_addr;

	assert(chan != NULL);
	assert(_desc != NULL);

	/* Common prep. */
	rc = _idxd_prep_command(chan, cb_fn, cb_arg, flags, &desc, &op);
	if (rc) {
		return rc;
	}

	/* Command specific. */
	flags = desc->flags;
	comp_addr = desc->completion_addr;
	memcpy(desc, _desc, sizeof(*desc));
	desc->flags |= flags;
	desc->completion_addr = comp_addr;

	/* Submit operation. */
	_submit_to_hw(chan, op);

	return 0;
}

static inline void
_dump_sw_error_reg(struct spdk_idxd_io_channel *chan)
{
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
	spdk_idxd_submit_fill;
        spdk_idxd_submit_compress;
        spdk_idxd_submit_decompress;
	spdk_idxd_submit_raw_desc;
	spdk_idxd_process_events;
	spdk_idxd_get_channel;
	spdk_idxd_put_channel;