From: Fiona Trahe Date: Fri, 27 Apr 2018 13:24:02 +0000 (+0100) Subject: compressdev: add device feature flags X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f40d300a8165fe6b54bd933aef5b0dda3d94c4e5;p=dpdk.git compressdev: add device feature flags Signed-off-by: Fiona Trahe Signed-off-by: Pablo de Lara Signed-off-by: Shally Verma Signed-off-by: Ashish Gupta --- diff --git a/lib/librte_compressdev/rte_compressdev.c b/lib/librte_compressdev/rte_compressdev.c index 0ffc43bb92..03f1ab8a75 100644 --- a/lib/librte_compressdev/rte_compressdev.c +++ b/lib/librte_compressdev/rte_compressdev.c @@ -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) { diff --git a/lib/librte_compressdev/rte_compressdev.h b/lib/librte_compressdev/rte_compressdev.h index f18c7ccf60..30cf64c6ee 100644 --- a/lib/librte_compressdev/rte_compressdev.h +++ b/lib/librte_compressdev/rte_compressdev.h @@ -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) diff --git a/lib/librte_compressdev/rte_compressdev_version.map b/lib/librte_compressdev/rte_compressdev_version.map index ca4d9d3d85..f9223bcfe9 100644 --- a/lib/librte_compressdev/rte_compressdev_version.map +++ b/lib/librte_compressdev/rte_compressdev_version.map @@ -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;