compressdev: add device feature flags
authorFiona Trahe <fiona.trahe@intel.com>
Fri, 27 Apr 2018 13:24:02 +0000 (14:24 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Thu, 10 May 2018 16:46:20 +0000 (17:46 +0100)
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>
lib/librte_compressdev/rte_compressdev.c
lib/librte_compressdev/rte_compressdev.h
lib/librte_compressdev/rte_compressdev_version.map

index 0ffc43b..03f1ab8 100644 (file)
@@ -31,6 +31,27 @@ static struct rte_compressdev_global compressdev_globals = {
 
 struct rte_compressdev_global *rte_compressdev_globals = &compressdev_globals;
 
+const char * __rte_experimental
+rte_compressdev_get_feature_name(uint64_t flag)
+{
+       switch (flag) {
+       case RTE_COMPDEV_FF_HW_ACCELERATED:
+               return "HW_ACCELERATED";
+       case RTE_COMPDEV_FF_CPU_SSE:
+               return "CPU_SSE";
+       case RTE_COMPDEV_FF_CPU_AVX:
+               return "CPU_AVX";
+       case RTE_COMPDEV_FF_CPU_AVX2:
+               return "CPU_AVX2";
+       case RTE_COMPDEV_FF_CPU_AVX512:
+               return "CPU_AVX512";
+       case RTE_COMPDEV_FF_CPU_NEON:
+               return "CPU_NEON";
+       default:
+               return NULL;
+       }
+}
+
 static struct rte_compressdev *
 rte_compressdev_get_dev(uint8_t dev_id)
 {
index f18c7cc..30cf64c 100644 (file)
@@ -21,9 +21,42 @@ extern "C" {
 
 #include "rte_comp.h"
 
+/**
+ * compression device supported feature flags
+ *
+ * @note New features flags should be added to the end of the list
+ *
+ * Keep these flags synchronised with rte_compressdev_get_feature_name()
+ */
+#define        RTE_COMPDEV_FF_HW_ACCELERATED           (1ULL << 0)
+/**< Operations are off-loaded to an external hardware accelerator */
+#define        RTE_COMPDEV_FF_CPU_SSE                  (1ULL << 1)
+/**< Utilises CPU SIMD SSE instructions */
+#define        RTE_COMPDEV_FF_CPU_AVX                  (1ULL << 2)
+/**< Utilises CPU SIMD AVX instructions */
+#define        RTE_COMPDEV_FF_CPU_AVX2                 (1ULL << 3)
+/**< Utilises CPU SIMD AVX2 instructions */
+#define        RTE_COMPDEV_FF_CPU_AVX512               (1ULL << 4)
+/**< Utilises CPU SIMD AVX512 instructions */
+#define        RTE_COMPDEV_FF_CPU_NEON                 (1ULL << 5)
+/**< Utilises CPU NEON instructions */
+
+/**
+ * Get the name of a compress device feature flag.
+ *
+ * @param flag
+ *   The mask describing the flag
+ *
+ * @return
+ *   The name of this flag, or NULL if it's not a valid feature flag.
+ */
+const char * __rte_experimental
+rte_compressdev_get_feature_name(uint64_t flag);
+
 /**  comp device information */
 struct rte_compressdev_info {
        const char *driver_name;                /**< Driver name. */
+       uint64_t feature_flags;                 /**< Feature flags */
        uint16_t max_nb_queue_pairs;
        /**< Maximum number of queues pairs supported by device.
         * (If 0, there is no limit in maximum number of queue pairs)
index ca4d9d3..f9223bc 100644 (file)
@@ -9,6 +9,7 @@ EXPERIMENTAL {
        rte_compressdev_dequeue_burst;
        rte_compressdev_devices_get;
        rte_compressdev_enqueue_burst;
+       rte_compressdev_get_feature_name;
        rte_compressdev_info_get;
        rte_compressdev_name_get;
        rte_compressdev_pmd_allocate;