summaryrefslogtreecommitdiff
path: root/drivers/compress/isal/isal_compress_pmd.c
diff options
context:
space:
mode:
authorLee Daly <lee.daly@intel.com>2018-05-09 17:14:31 +0100
committerPablo de Lara <pablo.de.lara.guarch@intel.com>2018-05-10 17:46:20 +0100
commit21fd1e594991ef0a20eb04af54a563eca7c18955 (patch)
treed9acef218a2e2a3d804f11ce9d3156ac69d51fd6 /drivers/compress/isal/isal_compress_pmd.c
parentb0e23c458a6f67f73ddccaaaf27a2b438bf27c43 (diff)
downloaddpdk-21fd1e594991ef0a20eb04af54a563eca7c18955.zip
dpdk-21fd1e594991ef0a20eb04af54a563eca7c18955.tar.gz
dpdk-21fd1e594991ef0a20eb04af54a563eca7c18955.tar.xz
compress/isal: support burst enqueue/dequeue
This patchs adds support for the compressdev enqueue_burst and dequeue_burst API operations. Signed-off-by: Lee Daly <lee.daly@intel.com> Reviewed-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Diffstat (limited to 'drivers/compress/isal/isal_compress_pmd.c')
-rw-r--r--drivers/compress/isal/isal_compress_pmd.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress/isal/isal_compress_pmd.c
index 1224dd0..aaa0593 100644
--- a/drivers/compress/isal/isal_compress_pmd.c
+++ b/drivers/compress/isal/isal_compress_pmd.c
@@ -187,6 +187,72 @@ isal_comp_set_priv_xform_parameters(struct isal_priv_xform *priv_xform,
return 0;
}
+/* Process compression/decompression operation */
+static int
+process_op(struct isal_comp_qp *qp __rte_unused,
+ struct rte_comp_op *op __rte_unused,
+ struct isal_priv_xform *priv_xform)
+{
+ switch (priv_xform->type) {
+ case RTE_COMP_COMPRESS:
+ break;
+ case RTE_COMP_DECOMPRESS:
+ break;
+ default:
+ ISAL_PMD_LOG(ERR, "Operation Not Supported\n");
+ return -ENOTSUP;
+ }
+ return 0;
+}
+
+/* Enqueue burst */
+static uint16_t
+isal_comp_pmd_enqueue_burst(void *queue_pair, struct rte_comp_op **ops,
+ uint16_t nb_ops)
+{
+ struct isal_comp_qp *qp = queue_pair;
+ uint16_t i;
+ int retval;
+ int16_t num_enq = RTE_MIN(qp->num_free_elements, nb_ops);
+
+ for (i = 0; i < num_enq; i++) {
+ if (unlikely(ops[i]->op_type != RTE_COMP_OP_STATELESS)) {
+ ops[i]->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
+ ISAL_PMD_LOG(ERR, "Stateful operation not Supported\n");
+ qp->qp_stats.enqueue_err_count++;
+ continue;
+ }
+ retval = process_op(qp, ops[i], ops[i]->private_xform);
+ if (unlikely(retval < 0) ||
+ ops[i]->status != RTE_COMP_OP_STATUS_SUCCESS) {
+ qp->qp_stats.enqueue_err_count++;
+ }
+ }
+
+ retval = rte_ring_enqueue_burst(qp->processed_pkts, (void *)ops,
+ num_enq, NULL);
+ qp->num_free_elements -= retval;
+ qp->qp_stats.enqueued_count += retval;
+
+ return retval;
+}
+
+/* Dequeue burst */
+static uint16_t
+isal_comp_pmd_dequeue_burst(void *queue_pair, struct rte_comp_op **ops,
+ uint16_t nb_ops)
+{
+ struct isal_comp_qp *qp = queue_pair;
+ uint16_t nb_dequeued;
+
+ nb_dequeued = rte_ring_dequeue_burst(qp->processed_pkts, (void **)ops,
+ nb_ops, NULL);
+ qp->num_free_elements += nb_dequeued;
+ qp->qp_stats.dequeued_count += nb_dequeued;
+
+ return nb_dequeued;
+}
+
/* Create ISA-L compression device */
static int
compdev_isal_create(const char *name, struct rte_vdev_device *vdev,
@@ -203,6 +269,10 @@ compdev_isal_create(const char *name, struct rte_vdev_device *vdev,
dev->dev_ops = isal_compress_pmd_ops;
+ /* register rx/tx burst functions for data path */
+ dev->dequeue_burst = isal_comp_pmd_dequeue_burst;
+ dev->enqueue_burst = isal_comp_pmd_enqueue_burst;
+
return 0;
}