From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pablo.de.lara.guarch@intel.com>
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id 485161C74C
 for <dev@dpdk.org>; Fri, 13 Apr 2018 20:18:38 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 13 Apr 2018 11:18:37 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.48,446,1517904000"; d="scan'208";a="50593044"
Received: from silpixa00399464.ir.intel.com (HELO
 silpixa00399464.ger.corp.intel.com) ([10.237.222.157])
 by orsmga002.jf.intel.com with ESMTP; 13 Apr 2018 11:18:35 -0700
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: dev@dpdk.org
Cc: fiona.trahe@intel.com, shally.verma@cavium.com, ahmed.mansour@nxp.com,
 Ashish.Gupta@cavium.com, Shally Verma <shally.verma@caviumnetworks.com>,
 Sunila Sahu <sunila.sahu@caviumnetworks.com>,
 Ashish Gupta <ashish.gupta@caviumnetworks.com>
Date: Fri, 13 Apr 2018 19:18:27 +0100
Message-Id: <20180413181832.11335-9-pablo.de.lara.guarch@intel.com>
X-Mailer: git-send-email 2.14.3
In-Reply-To: <20180413181832.11335-1-pablo.de.lara.guarch@intel.com>
References: <1517595924-25963-1-git-send-email-fiona.trahe@intel.com>
 <20180413181832.11335-1-pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev] [PATCH v5 08/13] compressdev: support hash operations
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 13 Apr 2018 18:18:40 -0000

From: Shally Verma <shally.verma@caviumnetworks.com>

- 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 <shally.verma@caviumnetworks.com>
Signed-off-by: Sunila Sahu <sunila.sahu@caviumnetworks.com>
Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>
---
 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 5020aed33..639c577b6 100644
--- a/lib/librte_compressdev/rte_comp.h
+++ b/lib/librte_compressdev/rte_comp.h
@@ -63,6 +63,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
@@ -172,6 +183,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.
+	 */
 };
 
 /**
@@ -187,6 +202,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.
+	 */
 };
 
 /**
@@ -278,6 +297,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