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

bdev/compress: updates to the poller function



Two quick updates, support dequeueing more than 1 IO at a time which
is now more likely given that we can queue up compression operations
(others can come in qhile one is on the queue).

Dropped the max inflight value as it was in there as a palceholder
and now it makes sense to give it a sane value. Also updated the value
passed to reduce to signal an error.

UT for the poller will come in the next patch...

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 37184dd4
Loading
Loading
Loading
Loading
+22 −24
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@

/* TODO: valdiate these are good starting values */
#define NUM_MAX_XFORMS 16
#define NUM_MAX_INFLIGHT_OPS 512
#define NUM_MAX_INFLIGHT_OPS 64
#define DEFAULT_WINDOW_SIZE 15
#define MAX_MBUFS_PER_OP 16
#define CHUNK_SIZE (1024 * 16)
@@ -528,40 +528,38 @@ comp_dev_poller(void *args)
{
	struct vbdev_compress *comp_bdev = args;
	uint8_t cdev_id = comp_bdev->device_qp->device->cdev_id;
	struct rte_comp_op *deq_ops;
	struct rte_comp_op *deq_ops[NUM_MAX_INFLIGHT_OPS];
	uint16_t num_deq;
	struct spdk_reduce_vol_cb_args *reduce_args;
	struct vbdev_comp_op *op_to_resubmit;
	int rc;
	int rc, i;

	num_deq = rte_compressdev_dequeue_burst(cdev_id, 0, deq_ops, NUM_MAX_INFLIGHT_OPS);
	for (i = 0; i < num_deq; i++) {
		reduce_args = (struct spdk_reduce_vol_cb_args *)deq_ops[i]->m_src->userdata;

	num_deq = rte_compressdev_dequeue_burst(cdev_id, 0, &deq_ops, 1);

	if (num_deq > 0) {
		reduce_args = (struct spdk_reduce_vol_cb_args *)deq_ops->m_src->userdata;
		assert(num_deq == 1);
		if (deq_ops->status != RTE_COMP_OP_STATUS_SUCCESS) {
			SPDK_ERRLOG("deque status %u\n", deq_ops->status);

			/* TODO update produced with translated -errno */
			/*
			 * RTE_COMP_OP_STATUS_SUCCESS = 0,
			 * RTE_COMP_OP_STATUS_NOT_PROCESSED,
			 * RTE_COMP_OP_STATUS_INVALID_ARGS,
			 * RTE_COMP_OP_STATUS_ERROR,
			 * RTE_COMP_OP_STATUS_INVALID_STATE,
			 * RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED,
			 * RTE_COMP_OP_STATUS_OUT_OF_SPACE_RECOVERABLE,
		if (deq_ops[i]->status != RTE_COMP_OP_STATUS_SUCCESS) {
			SPDK_ERRLOG("deque status %u\n", deq_ops[i]->status);

			/* Reduce will simply store uncompressed on any negative value
			 * passed in to deq_ops[i]->produced so set that now.
			 */
			deq_ops[i]->produced = -EINVAL;
		}
		reduce_args->cb_fn(reduce_args->cb_arg, deq_ops->produced);
		reduce_args->cb_fn(reduce_args->cb_arg, deq_ops[i]->produced);

		/* Now free both mbufs and the compress operation. The rte_pktmbuf_free()
		 * call takes care of freeing all of the mbufs in the chain back to their
		 * original pool.
		 */
		rte_pktmbuf_free(deq_ops->m_src);
		rte_pktmbuf_free(deq_ops->m_dst);
		rte_comp_op_free(deq_ops);
		rte_pktmbuf_free(deq_ops[i]->m_src);
		rte_pktmbuf_free(deq_ops[i]->m_dst);

		/* There is no bulk free for com ops so we have to free them one at a time
		 * here however it would be rare that we'd ever have more than 1 at a time
		 * anyways.
		 */
		rte_comp_op_free(deq_ops[i]);

		/* Check if there are any pending comp ops to process */
		while (!TAILQ_EMPTY(&comp_bdev->queued_comp_ops)) {