From 96fe0fb199dc45a344a53ca7a4aa9971adfe3f83 Mon Sep 17 00:00:00 2001 From: paul luse Date: Wed, 15 May 2019 18:27:51 -0400 Subject: [PATCH] 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: paul luse Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454680 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- lib/bdev/compress/vbdev_compress.c | 42 ++++++++++++++---------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/lib/bdev/compress/vbdev_compress.c b/lib/bdev/compress/vbdev_compress.c index 0141360190..3719484dd4 100644 --- a/lib/bdev/compress/vbdev_compress.c +++ b/lib/bdev/compress/vbdev_compress.c @@ -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, 1); + 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; - 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); + if (deq_ops[i]->status != RTE_COMP_OP_STATUS_SUCCESS) { + SPDK_ERRLOG("deque status %u\n", deq_ops[i]->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, + /* 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)) {