[dpdk-dev] [PATCH v6 10/14] compressdev: add compression service feature flags
Pablo de Lara
pablo.de.lara.guarch at intel.com
Fri Apr 27 15:24:03 CEST 2018
From: Fiona Trahe <fiona.trahe at intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe at intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
Signed-off-by: Shally Verma <shally.verma at caviumnetworks.com>
Signed-off-by: Ashish Gupta <ashish.gupta at caviumnetworks.com>
---
lib/librte_compressdev/rte_comp.c | 31 +++++++++++++++
lib/librte_compressdev/rte_comp.h | 46 ++++++++++++++++++++++
lib/librte_compressdev/rte_compressdev_version.map | 1 +
3 files changed, 78 insertions(+)
diff --git a/lib/librte_compressdev/rte_comp.c b/lib/librte_compressdev/rte_comp.c
index eb99e99d2..d596ba872 100644
--- a/lib/librte_compressdev/rte_comp.c
+++ b/lib/librte_compressdev/rte_comp.c
@@ -6,6 +6,37 @@
#include "rte_compressdev.h"
#include "rte_compressdev_internal.h"
+const char * __rte_experimental
+rte_comp_get_feature_name(uint64_t flag)
+{
+ switch (flag) {
+ case RTE_COMP_FF_STATEFUL_COMPRESSION:
+ return "STATEFUL_COMPRESSION";
+ case RTE_COMP_FF_STATEFUL_DECOMPRESSION:
+ return "STATEFUL_DECOMPRESSION";
+ case RTE_COMP_FF_MBUF_SCATTER_GATHER:
+ return "MBUF_SCATTER_GATHER";
+ case RTE_COMP_FF_MULTI_PKT_CHECKSUM:
+ return "MULTI_PKT_CHECKSUM";
+ case RTE_COMP_FF_ADLER32_CHECKSUM:
+ return "ADLER32_CHECKSUM";
+ case RTE_COMP_FF_CRC32_CHECKSUM:
+ return "CRC32_CHECKSUM";
+ case RTE_COMP_FF_CRC32_ADLER32_CHECKSUM:
+ return "CRC32_ADLER32_CHECKSUM";
+ case RTE_COMP_FF_NONCOMPRESSED_BLOCKS:
+ return "NONCOMPRESSED_BLOCKS";
+ case RTE_COMP_FF_SHA1_HASH:
+ return "SHA1_HASH";
+ case RTE_COMP_FF_SHA2_SHA256_HASH:
+ return "SHA2_SHA256_HASH";
+ case RTE_COMP_FF_SHAREABLE_PRIV_XFORM:
+ return "SHAREABLE_PRIV_XFORM";
+ default:
+ return NULL;
+ }
+}
+
/**
* Reset the fields of an operation to their default values.
*
diff --git a/lib/librte_compressdev/rte_comp.h b/lib/librte_compressdev/rte_comp.h
index 6df1779af..4c802195f 100644
--- a/lib/librte_compressdev/rte_comp.h
+++ b/lib/librte_compressdev/rte_comp.h
@@ -19,6 +19,40 @@ extern "C" {
#include <rte_mempool.h>
#include <rte_mbuf.h>
+/**
+ * compression service feature flags
+ *
+ * @note New features flags should be added to the end of the list
+ *
+ * Keep these flags synchronised with rte_comp_get_feature_name()
+ */
+#define RTE_COMP_FF_STATEFUL_COMPRESSION (1ULL << 0)
+/**< Stateful compression is supported */
+#define RTE_COMP_FF_STATEFUL_DECOMPRESSION (1ULL << 1)
+/**< Stateful decompression is supported */
+#define RTE_COMP_FF_MBUF_SCATTER_GATHER (1ULL << 2)
+/**< Scatter-gather mbufs are supported */
+#define RTE_COMP_FF_ADLER32_CHECKSUM (1ULL << 3)
+/**< Adler-32 Checksum is supported */
+#define RTE_COMP_FF_CRC32_CHECKSUM (1ULL << 4)
+/**< CRC32 Checksum is supported */
+#define RTE_COMP_FF_CRC32_ADLER32_CHECKSUM (1ULL << 5)
+/**< Adler-32/CRC32 Checksum is supported */
+#define RTE_COMP_FF_MULTI_PKT_CHECKSUM (1ULL << 6)
+/**< Generation of checksum across multiple stateless packets is supported */
+#define RTE_COMP_FF_SHA1_HASH (1ULL << 7)
+/**< SHA1 Hash is supported */
+#define RTE_COMP_FF_SHA2_SHA256_HASH (1ULL << 8)
+/**< SHA256 Hash of SHA2 family is supported */
+#define RTE_COMP_FF_NONCOMPRESSED_BLOCKS (1ULL << 9)
+/**< Creation of non-compressed blocks using RTE_COMP_LEVEL_NONE is supported */
+#define RTE_COMP_FF_SHAREABLE_PRIV_XFORM (1ULL << 10)
+/**< Private xforms created by the PMD can be shared
+ * across multiple stateless operations. If not set, then app needs
+ * to create as many priv_xforms as it expects to have stateless
+ * operations in-flight.
+ */
+
/** Status of comp operation */
enum rte_comp_op_status {
RTE_COMP_OP_STATUS_SUCCESS = 0,
@@ -405,6 +439,18 @@ rte_comp_op_bulk_alloc(struct rte_mempool *mempool,
void __rte_experimental
rte_comp_op_free(struct rte_comp_op *op);
+/**
+ * Get the name of a compress service 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_comp_get_feature_name(uint64_t flag);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_compressdev/rte_compressdev_version.map b/lib/librte_compressdev/rte_compressdev_version.map
index f9223bcfe..5ed3080b4 100644
--- a/lib/librte_compressdev/rte_compressdev_version.map
+++ b/lib/librte_compressdev/rte_compressdev_version.map
@@ -28,6 +28,7 @@ EXPERIMENTAL {
rte_compressdev_stop;
rte_compressdev_stream_create;
rte_compressdev_stream_free;
+ rte_comp_get_feature_name;
rte_comp_op_alloc;
rte_comp_op_bulk_alloc;
rte_comp_op_free;
--
2.14.3
More information about the dev
mailing list