From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pablo de Lara Subject: [PATCH v4 08/13] compressdev: support hash operations Date: Sun, 8 Apr 2018 13:58:16 +0100 Message-ID: <20180408125821.20330-9-pablo.de.lara.guarch@intel.com> References: <20180406180512.40154-1-pablo.de.lara.guarch@intel.com> <20180408125821.20330-1-pablo.de.lara.guarch@intel.com> Cc: fiona.trahe@intel.com, shally.verma@cavium.com, ahmed.mansour@nxp.com, Ashish.Gupta@cavium.com, Shally Verma , Sunila Sahu , Ashish Gupta To: dev@dpdk.org Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 94DE81B655 for ; Sun, 8 Apr 2018 14:58:28 +0200 (CEST) In-Reply-To: <20180408125821.20330-1-pablo.de.lara.guarch@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Shally Verma - Added hash algo enumeration and params in xform and rte_comp_op - Updated compress/decompress xform to input hash algorithm - Updated struct rte_comp_op to input hash buffer User in capability query will know about support hashes via device info comp_feature_flag. If supported, application can initialize desired algorithm enumeration in xform structure and pass valid hash buffer during enqueue_burst(). Signed-off-by: Shally Verma Signed-off-by: Sunila Sahu Signed-off-by: Ashish Gupta --- lib/librte_compressdev/rte_comp.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/librte_compressdev/rte_comp.h b/lib/librte_compressdev/rte_comp.h index 4cf84c5db..055f2ee75 100644 --- a/lib/librte_compressdev/rte_comp.h +++ b/lib/librte_compressdev/rte_comp.h @@ -55,6 +55,17 @@ enum rte_comp_algorithm { RTE_COMP_ALGO_LIST_END }; +/** Compression Hash Algorithms */ +enum rte_comp_hash_algorithm { + RTE_COMP_HASH_ALGO_UNSPECIFIED = 0, + /**< No hash */ + RTE_COMP_HASH_ALGO_SHA1, + /**< SHA1 hash algorithm */ + RTE_COMP_HASH_ALGO_SHA2_256, + /**< SHA256 hash algorithm of SHA2 family */ + RTE_COMP_HASH_ALGO_LIST_END +}; + /**< Compression Level. * The number is interpreted by each PMD differently. However, lower numbers * give fastest compression, at the expense of compression ratio while @@ -162,6 +173,10 @@ struct rte_comp_compress_xform { */ enum rte_comp_checksum_type chksum; /**< Type of checksum to generate on the uncompressed data */ + enum rte_comp_hash_algorithm hash_algo; + /**< Hash algorithm to be used with compress operation. Hash is always + * done on plaintext. + */ }; /** @@ -177,6 +192,10 @@ struct rte_comp_decompress_xform { * compressed data. If window size can't be supported by the PMD then * setup of stream or private_xform should fail. */ + enum rte_comp_hash_algorithm hash_algo; + /**< Hash algorithm to be used with decompress operation. Hash is always + * done on plaintext. + */ }; /** @@ -268,6 +287,19 @@ struct rte_comp_op { * decompress direction. */ } dst; + struct { + uint8_t *digest; + /**< Output buffer to store hash output, if enabled in xform. + * Buffer would contain valid value only after an op with + * flush flag = RTE_COMP_FLUSH_FULL/FLUSH_FINAL is processed + * successfully. + * + * Length of buffer should be contiguous and large enough to + * accommodate digest produced by specific hash algo. + */ + rte_iova_t iova_addr; + /**< IO address of the buffer */ + } hash; enum rte_comp_flush_flag flush_flag; /**< Defines flush characteristics for the output data. * Only applicable in compress direction -- 2.14.3