compress/isal: add basic PMD ops
authorLee Daly <lee.daly@intel.com>
Wed, 9 May 2018 16:14:28 +0000 (17:14 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Thu, 10 May 2018 16:46:20 +0000 (17:46 +0100)
Add basic device poll mode driver operations to
give ability to start, stop, close device etc.

Signed-off-by: Lee Daly <lee.daly@intel.com>
Reviewed-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
drivers/compress/isal/isal_compress_pmd_ops.c
drivers/compress/isal/isal_compress_pmd_private.h

index cff05b4..2f828c5 100644 (file)
@@ -2,18 +2,71 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#include <rte_common.h>
 #include <rte_compressdev_pmd.h>
 
+#include "isal_compress_pmd_private.h"
+
+static const struct rte_compressdev_capabilities isal_pmd_capabilities[] = {
+       RTE_COMP_END_OF_CAPABILITIES_LIST()
+};
+
+/** Configure device */
+static int
+isal_comp_pmd_config(struct rte_compressdev *dev __rte_unused,
+               struct rte_compressdev_config *config __rte_unused)
+{
+       return 0;
+}
+
+/** Start device */
+static int
+isal_comp_pmd_start(__rte_unused struct rte_compressdev *dev)
+{
+       return 0;
+}
+
+/** Stop device */
+static void
+isal_comp_pmd_stop(__rte_unused struct rte_compressdev *dev)
+{
+}
+
+/** Close device */
+static int
+isal_comp_pmd_close(struct rte_compressdev *dev)
+{
+       /* Free private data */
+       struct isal_comp_private *internals = dev->data->dev_private;
+
+       rte_mempool_free(internals->priv_xform_mp);
+       return 0;
+}
+
+/** Get device info */
+static void
+isal_comp_pmd_info_get(struct rte_compressdev *dev __rte_unused,
+               struct rte_compressdev_info *dev_info)
+{
+       if (dev_info != NULL) {
+               dev_info->capabilities = isal_pmd_capabilities;
+               dev_info->feature_flags = RTE_COMPDEV_FF_CPU_AVX512 |
+                               RTE_COMPDEV_FF_CPU_AVX2 |
+                               RTE_COMPDEV_FF_CPU_AVX |
+                               RTE_COMPDEV_FF_CPU_SSE;
+       }
+}
+
 struct rte_compressdev_ops isal_pmd_ops = {
-               .dev_configure          = NULL,
-               .dev_start              = NULL,
-               .dev_stop               = NULL,
-               .dev_close              = NULL,
+               .dev_configure          = isal_comp_pmd_config,
+               .dev_start              = isal_comp_pmd_start,
+               .dev_stop               = isal_comp_pmd_stop,
+               .dev_close              = isal_comp_pmd_close,
 
                .stats_get              = NULL,
                .stats_reset            = NULL,
 
-               .dev_infos_get          = NULL,
+               .dev_infos_get          = isal_comp_pmd_info_get,
 
                .queue_pair_setup       = NULL,
                .queue_pair_release     = NULL,
index 09ecfb7..efbe68b 100644 (file)
@@ -18,6 +18,18 @@ struct isal_comp_private {
        struct rte_mempool *priv_xform_mp;
 };
 
+/** ISA-L queue pair */
+struct isal_comp_qp {
+       /* Queue Pair Identifier */
+       uint16_t id;
+       /* Unique Queue Pair Name */
+       char name[RTE_COMPRESSDEV_NAME_MAX_LEN];
+       /* Queue pair statistics */
+       struct rte_compressdev_stats qp_stats;
+       /* Number of free elements on ring */
+       uint16_t num_free_elements;
+} __rte_cache_aligned;
+
 /** device specific operations function pointer structure */
 extern struct rte_compressdev_ops *isal_compress_pmd_ops;