[API-NEXT,v2] api: packet: introduce odp_packet_data_range_t

Message ID 20170504113050.17686-1-dmitry.ereminsolenikov@linaro.org
State New
Headers show

Commit Message

Dmitry Eremin-Solenikov May 4, 2017, 11:30 a.m.
Rename odp_crypto_data_range_t to odp_packet_data_range_t, as it is
relevant not only to the crypto interface.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
 include/odp/api/spec/crypto.h                           | 17 +++++++----------
 include/odp/api/spec/packet.h                           | 12 ++++++++++++
 .../validation/api/crypto/odp_crypto_test_inp.c         |  4 ++--
 test/common_plat/validation/api/crypto/test_vectors.h   |  4 ++--
 4 files changed, 23 insertions(+), 14 deletions(-)

-- 
2.11.0

Comments

Savolainen, Petri (Nokia - FI/Espoo) May 5, 2017, 7:01 a.m. | #1
Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org>


> -----Original Message-----

> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of

> Dmitry Eremin-Solenikov

> Sent: Thursday, May 04, 2017 2:31 PM

> To: lng-odp@lists.linaro.org

> Subject: [lng-odp] [PATCH API-NEXT v2] api: packet: introduce

> odp_packet_data_range_t

> 

> Rename odp_crypto_data_range_t to odp_packet_data_range_t, as it is

> relevant not only to the crypto interface.

> 

> Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

> ---

>  include/odp/api/spec/crypto.h                           | 17 +++++++-----

> -----

>  include/odp/api/spec/packet.h                           | 12 ++++++++++++

>  .../validation/api/crypto/odp_crypto_test_inp.c         |  4 ++--

>  test/common_plat/validation/api/crypto/test_vectors.h   |  4 ++--

>  4 files changed, 23 insertions(+), 14 deletions(-)

> 

> diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h

> index 181c0cc4..4b0ee039 100644

> --- a/include/odp/api/spec/crypto.h

> +++ b/include/odp/api/spec/crypto.h

> @@ -21,6 +21,8 @@

>  extern "C" {

>  #endif

> 

> +#include <odp/api/packet.h>

> +

>  /** @defgroup odp_crypto ODP CRYPTO

>   *  Macros, enums, types and operations to utilise crypto.

>   *  @{

> @@ -243,15 +245,10 @@ typedef struct odp_crypto_iv {

> 

>  /**

>   * Crypto API data range specifier

> + *

> + * @deprecated  Use odp_packet_data_range_t instead

>   */

> -typedef struct odp_crypto_data_range {

> -	/** Offset from beginning of packet */

> -	uint32_t offset;

> -

> -	/** Length of data to operate on */

> -	uint32_t length;

> -

> -} odp_crypto_data_range_t;

> +typedef odp_packet_data_range_t ODP_DEPRECATE(odp_crypto_data_range_t);

> 

>  /**

>   * Crypto API session creation parameters

> @@ -370,10 +367,10 @@ typedef struct odp_crypto_op_param_t {

>  	uint32_t hash_result_offset;

> 

>  	/** Data range to apply cipher */

> -	odp_crypto_data_range_t cipher_range;

> +	odp_packet_data_range_t cipher_range;

> 

>  	/** Data range to authenticate */

> -	odp_crypto_data_range_t auth_range;

> +	odp_packet_data_range_t auth_range;

> 

>  } odp_crypto_op_param_t;

> 

> diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h

> index 5439f234..95f5349b 100644

> --- a/include/odp/api/spec/packet.h

> +++ b/include/odp/api/spec/packet.h

> @@ -71,6 +71,18 @@ extern "C" {

>    * Packet is red

>    */

> 

> +/**

> + * Packet API data range specifier

> + */

> +typedef struct odp_packet_data_range {

> +	/** Offset from beginning of packet */

> +	uint32_t offset;

> +

> +	/** Length of data to operate on */

> +	uint32_t length;

> +

> +} odp_packet_data_range_t;

> +

>  /*

>   *

>   * Alloc and free

> diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c

> b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c

> index db380c23..24ea4932 100644

> --- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c

> +++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c

> @@ -72,8 +72,8 @@ static void alg_test(odp_crypto_op_t op,

>  		     odp_crypto_key_t cipher_key,

>  		     odp_auth_alg_t auth_alg,

>  		     odp_crypto_key_t auth_key,

> -		     odp_crypto_data_range_t *cipher_range,

> -		     odp_crypto_data_range_t *auth_range,

> +		     odp_packet_data_range_t *cipher_range,

> +		     odp_packet_data_range_t *auth_range,

>  		     const uint8_t *plaintext,

>  		     unsigned int plaintext_len,

>  		     const uint8_t *ciphertext,

> diff --git a/test/common_plat/validation/api/crypto/test_vectors.h

> b/test/common_plat/validation/api/crypto/test_vectors.h

> index da4610f3..a1cf4faf 100644

> --- a/test/common_plat/validation/api/crypto/test_vectors.h

> +++ b/test/common_plat/validation/api/crypto/test_vectors.h

> @@ -139,14 +139,14 @@ static uint8_t

> aes128_gcm_reference_iv[][AES128_GCM_IV_LEN] = {

> 

>  static uint32_t aes128_gcm_reference_length[] = { 84, 72, 72, 40};

> 

> -static odp_crypto_data_range_t aes128_gcm_cipher_range[] = {

> +static odp_packet_data_range_t aes128_gcm_cipher_range[] = {

>  	{ .offset = 12, .length = 72 },

>  	{ .offset = 8, .length = 64 },

>  	{ .offset = 8, .length = 64 },

>  	{ .offset = 12, .length = 28 },

>  };

> 

> -static odp_crypto_data_range_t aes128_gcm_auth_range[] = {

> +static odp_packet_data_range_t aes128_gcm_auth_range[] = {

>  	{ .offset = 0, .length = 84 },

>  	{ .offset = 0, .length = 72 },

>  	{ .offset = 0, .length = 72 },

> --

> 2.11.0

Patch hide | download patch | download mbox

diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index 181c0cc4..4b0ee039 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -21,6 +21,8 @@ 
 extern "C" {
 #endif
 
+#include <odp/api/packet.h>
+
 /** @defgroup odp_crypto ODP CRYPTO
  *  Macros, enums, types and operations to utilise crypto.
  *  @{
@@ -243,15 +245,10 @@  typedef struct odp_crypto_iv {
 
 /**
  * Crypto API data range specifier
+ *
+ * @deprecated  Use odp_packet_data_range_t instead
  */
-typedef struct odp_crypto_data_range {
-	/** Offset from beginning of packet */
-	uint32_t offset;
-
-	/** Length of data to operate on */
-	uint32_t length;
-
-} odp_crypto_data_range_t;
+typedef odp_packet_data_range_t ODP_DEPRECATE(odp_crypto_data_range_t);
 
 /**
  * Crypto API session creation parameters
@@ -370,10 +367,10 @@  typedef struct odp_crypto_op_param_t {
 	uint32_t hash_result_offset;
 
 	/** Data range to apply cipher */
-	odp_crypto_data_range_t cipher_range;
+	odp_packet_data_range_t cipher_range;
 
 	/** Data range to authenticate */
-	odp_crypto_data_range_t auth_range;
+	odp_packet_data_range_t auth_range;
 
 } odp_crypto_op_param_t;
 
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 5439f234..95f5349b 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -71,6 +71,18 @@  extern "C" {
   * Packet is red
   */
 
+/**
+ * Packet API data range specifier
+ */
+typedef struct odp_packet_data_range {
+	/** Offset from beginning of packet */
+	uint32_t offset;
+
+	/** Length of data to operate on */
+	uint32_t length;
+
+} odp_packet_data_range_t;
+
 /*
  *
  * Alloc and free
diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
index db380c23..24ea4932 100644
--- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
@@ -72,8 +72,8 @@  static void alg_test(odp_crypto_op_t op,
 		     odp_crypto_key_t cipher_key,
 		     odp_auth_alg_t auth_alg,
 		     odp_crypto_key_t auth_key,
-		     odp_crypto_data_range_t *cipher_range,
-		     odp_crypto_data_range_t *auth_range,
+		     odp_packet_data_range_t *cipher_range,
+		     odp_packet_data_range_t *auth_range,
 		     const uint8_t *plaintext,
 		     unsigned int plaintext_len,
 		     const uint8_t *ciphertext,
diff --git a/test/common_plat/validation/api/crypto/test_vectors.h b/test/common_plat/validation/api/crypto/test_vectors.h
index da4610f3..a1cf4faf 100644
--- a/test/common_plat/validation/api/crypto/test_vectors.h
+++ b/test/common_plat/validation/api/crypto/test_vectors.h
@@ -139,14 +139,14 @@  static uint8_t aes128_gcm_reference_iv[][AES128_GCM_IV_LEN] = {
 
 static uint32_t aes128_gcm_reference_length[] = { 84, 72, 72, 40};
 
-static odp_crypto_data_range_t aes128_gcm_cipher_range[] = {
+static odp_packet_data_range_t aes128_gcm_cipher_range[] = {
 	{ .offset = 12, .length = 72 },
 	{ .offset = 8, .length = 64 },
 	{ .offset = 8, .length = 64 },
 	{ .offset = 12, .length = 28 },
 };
 
-static odp_crypto_data_range_t aes128_gcm_auth_range[] = {
+static odp_packet_data_range_t aes128_gcm_auth_range[] = {
 	{ .offset = 0, .length = 84 },
 	{ .offset = 0, .length = 72 },
 	{ .offset = 0, .length = 72 },