[lng-odp] [PATCH API-NEXT v5 1/6] validation: crypto: stop declaring test functions as public

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

There is no use to declare test functions as public, they are defined
and used in the same file.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 352 (lumag:crypto_gmac_iv)
 ** https://github.com/Linaro/odp/pull/352
 ** Patch: https://github.com/Linaro/odp/pull/352.patch
 ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4
 ** Merge commit sha: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23
 **/
 test/validation/api/crypto/crypto.h  | 30 -
 test/validation/api/crypto/odp_crypto_test_inp.c | 56 
 2 files changed, 28 insertions(+), 58 deletions(-)

diff --git a/test/validation/api/crypto/crypto.h 
b/test/validation/api/crypto/crypto.h
index 078a1909f..7c248d9eb 100644
--- a/test/validation/api/crypto/crypto.h
+++ b/test/validation/api/crypto/crypto.h
@@ -9,36 +9,6 @@
 
 #include "odp_cunit_common.h"
 
-/* test functions: */
-void crypto_test_enc_alg_null(void);
-void crypto_test_dec_alg_null(void);
-void crypto_test_enc_alg_3des_cbc(void);
-void crypto_test_enc_alg_3des_cbc_ovr_iv(void);
-void crypto_test_dec_alg_3des_cbc(void);
-void crypto_test_dec_alg_3des_cbc_ovr_iv(void);
-void crypto_test_enc_alg_aes_cbc(void);
-void crypto_test_enc_alg_aes_cbc_ovr_iv(void);
-void crypto_test_dec_alg_aes_cbc(void);
-void crypto_test_dec_alg_aes_cbc_ovr_iv(void);
-void crypto_test_enc_alg_aes_ctr(void);
-void crypto_test_enc_alg_aes_ctr_ovr_iv(void);
-void crypto_test_dec_alg_aes_ctr(void);
-void crypto_test_dec_alg_aes_ctr_ovr_iv(void);
-void crypto_test_enc_alg_aes_gcm(void);
-void crypto_test_enc_alg_aes_gcm_ovr_iv(void);
-void crypto_test_dec_alg_aes_gcm(void);
-void crypto_test_dec_alg_aes_gcm_ovr_iv(void);
-void crypto_test_gen_alg_hmac_md5(void);
-void crypto_test_check_alg_hmac_md5(void);
-void crypto_test_gen_alg_hmac_sha1(void);
-void crypto_test_check_alg_hmac_sha1(void);
-void crypto_test_gen_alg_hmac_sha256(void);
-void crypto_test_check_alg_hmac_sha256(void);
-void crypto_test_gen_alg_hmac_sha512(void);
-void crypto_test_check_alg_hmac_sha512(void);
-void crypto_test_gen_alg_aes_gmac(void);
-void crypto_test_check_alg_aes_gmac(void);
-
 /* test arrays: */
 extern odp_testinfo_t crypto_suite[];
 
diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c 
b/test/validation/api/crypto/odp_crypto_test_inp.c
index 821bdc7e4..c7076d300 100644
--- a/test/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/validation/api/crypto/odp_crypto_test_inp.c
@@ -631,7 +631,7 @@ static int check_alg_null(void)
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_NULL);
 }
 
-void crypto_test_enc_alg_null(void)
+static void crypto_test_enc_alg_null(void)
 {
unsigned int test_vec_num = (sizeof(null_reference) /
 sizeof(null_reference[0]));
@@ -645,7 +645,7 @@ void crypto_test_enc_alg_null(void)
 false);
 }
 
-void crypto_test_dec_alg_null(void)
+static void crypto_test_dec_alg_null(void)
 {
unsigned int test_vec_num = (sizeof(null_reference) /
 sizeof(null_reference[0]));
@@ -668,7 +668,7 @@ static int check_alg_3des_cbc(void)
  * operation for 3DES_CBC algorithm. IV for the operation is the session IV.
  * In addition the test verifies if the implementation can use the
  * packet buffer as completion event buffer.*/
-void crypto_test_enc_alg_3des_cbc(void)
+static void crypto_test_enc_alg_3des_cbc(void)
 {
unsigned int test_vec_num = (sizeof(tdes_cbc_reference) /
 sizeof(tdes_cbc_reference[0]));
@@ -685,7 +685,7 @@ void crypto_test_enc_alg_3des_cbc(void)
 /* This test verifies the correctness of encode (plaintext -> ciphertext)
  * operation for 3DES_CBC algorithm. IV for the operation is the operation IV.
  * */
-void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
+static void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
 {
unsigned int test_vec_num = (sizeof(tdes_cbc_reference) /
 sizeof(tdes_cbc_reference[0]));
@@ -704,7 +704,7 @@ void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
  * In addition the test verifies if the implementation can use the
  * packet buffer as completion event buffer.
  * */
-void crypto_test_dec_alg_3des_cbc(void)
+static void crypto_test_dec_alg_3des_cbc(void)
 {
unsigned int test_vec_num = (sizeof(tdes_cbc_reference) /
 sizeof(tdes_cbc_reference[0]));
@@ -723,7 +723,7 @@ void crypto_test_dec_alg_3des_cbc(void)
  * In addition the test verifies if the implementation can use the
  * packet buffer as completion event buffer.
  * */
-void crypto_test_dec_alg_3des_cbc_ovr_iv(void)
+static void crypto_test_dec_alg_3des_cbc_ovr_iv(void)
 {
unsigned int test_vec_num = (sizeof(tdes_cbc_reference) /
 sizeof(tdes_cbc_reference[0]));
@@ 

[lng-odp] [PATCH API-NEXT v5 0/6] Add separate auth IV

2018-01-03 Thread Github ODP bot
I was thinking again about GMAC auth case. Currently GMAC just reuses cipher IV 
data fields, which is not future proof and not quite obvious. So let's add 
separate set of IV-related fields for authentication algorithms.

github
/** Email created from pull request 352 (lumag:crypto_gmac_iv)
 ** https://github.com/Linaro/odp/pull/352
 ** Patch: https://github.com/Linaro/odp/pull/352.patch
 ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4
 ** Merge commit sha: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 260 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 71 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
WARNING: line over 80 characters
#111: FILE: platform/linux-generic/odp_crypto.c:500:
+ ((uint32_t)EVP_CIPHER_iv_length(cipher) == 
session->p.cipher_iv.length)))

total: 0 errors, 1 warnings, 0 checks, 201 lines checked


to_send-p-002.patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 0 checks, 36 lines checked


to_send-p-003.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 180 lines checked


to_send-p-004.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 120 lines checked


to_send-p-005.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH API-NEXT v5 2/6] linux-gen: crypto: move session type to odp_crypto module

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

There is no point in having odp_crypto_generic_session_t definition in
global include file. Move it to odp_crypto module.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 352 (lumag:crypto_gmac_iv)
 ** https://github.com/Linaro/odp/pull/352
 ** Patch: https://github.com/Linaro/odp/pull/352.patch
 ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4
 ** Merge commit sha: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23
 **/
 platform/linux-generic/Makefile.am |  1 -
 .../linux-generic/include/odp_crypto_internal.h| 73 --
 platform/linux-generic/odp_crypto.c| 46 +-
 3 files changed, 44 insertions(+), 76 deletions(-)
 delete mode 100644 platform/linux-generic/include/odp_crypto_internal.h

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 9f7993d81..12d8131e8 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -140,7 +140,6 @@ noinst_HEADERS = \
  include/odp_classification_inlines.h \
  include/odp_classification_internal.h \
  include/odp_config_internal.h \
- include/odp_crypto_internal.h \
  include/odp_debug_internal.h \
  include/odp_errno_define.h \
  include/odp_forward_typedefs_internal.h \
diff --git a/platform/linux-generic/include/odp_crypto_internal.h 
b/platform/linux-generic/include/odp_crypto_internal.h
deleted file mode 100644
index 32178d9de..0
--- a/platform/linux-generic/include/odp_crypto_internal.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (c) 2014, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef ODP_CRYPTO_INTERNAL_H_
-#define ODP_CRYPTO_INTERNAL_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include 
-
-#define MAX_IV_LEN  64
-#define OP_RESULT_MAGIC 0x91919191
-
-/** Forward declaration of session structure */
-typedef struct odp_crypto_generic_session odp_crypto_generic_session_t;
-
-/**
- * Algorithm handler function prototype
- */
-typedef
-odp_crypto_alg_err_t (*crypto_func_t)(odp_packet_t pkt,
- const odp_crypto_packet_op_param_t *param,
- odp_crypto_generic_session_t *session);
-
-/**
- * Per crypto session data structure
- */
-struct odp_crypto_generic_session {
-   struct odp_crypto_generic_session *next;
-
-   /* Session creation parameters */
-   odp_crypto_session_param_t p;
-
-   odp_bool_t do_cipher_first;
-
-   struct {
-   /* Copy of session IV data */
-   uint8_t iv_data[MAX_IV_LEN];
-   uint8_t key_data[EVP_MAX_KEY_LENGTH];
-
-   const EVP_CIPHER *evp_cipher;
-   crypto_func_t func;
-   } cipher;
-
-   struct {
-   uint8_t  key[EVP_MAX_KEY_LENGTH];
-   uint32_t key_length;
-   union {
-   const EVP_MD *evp_md;
-   const EVP_CIPHER *evp_cipher;
-   };
-   crypto_func_t func;
-   } auth;
-};
-
-/**
- * Per session creation operation result
- */
-typedef struct odp_crypto_generic_session_result {
-   odp_crypto_ses_create_err_trc;
-   odp_crypto_session_t   session;
-} odp_crypto_generic_session_result_t;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 2038aa46b..3b110c191 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -89,6 +88,49 @@ static const odp_crypto_auth_capability_t 
auth_capa_aes_gcm[] = {
 static const odp_crypto_auth_capability_t auth_capa_aes_gmac[] = {
 {.digest_len = 16, .key_len = 16, .aad_len = {.min = 0, .max = 0, .inc = 0} } 
};
 
+/** Forward declaration of session structure */
+typedef struct odp_crypto_generic_session_t odp_crypto_generic_session_t;
+
+/**
+ * Algorithm handler function prototype
+ */
+typedef
+odp_crypto_alg_err_t (*crypto_func_t)(odp_packet_t pkt,
+ const odp_crypto_packet_op_param_t *param,
+ odp_crypto_generic_session_t *session);
+
+/**
+ * Per crypto session data structure
+ */
+struct odp_crypto_generic_session_t {
+   odp_crypto_generic_session_t *next;
+
+   /* Session creation parameters */
+   odp_crypto_session_param_t p;
+
+   odp_bool_t do_cipher_first;
+
+   struct {
+   /* Copy of session IV data */
+   uint8_t iv_data[EVP_MAX_IV_LENGTH];
+   uint8_t key_data[EVP_MAX_KEY_LENGTH];
+
+   const EVP_CIPHER *evp_cipher;

[lng-odp] [PATCH API-NEXT v5 5/6] validation: crypto: use auth IV for GMAC test case

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Change GMAC testing code to use new auth IV fields.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 352 (lumag:crypto_gmac_iv)
 ** https://github.com/Linaro/odp/pull/352
 ** Patch: https://github.com/Linaro/odp/pull/352.patch
 ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4
 ** Merge commit sha: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23
 **/
 test/validation/api/crypto/odp_crypto_test_inp.c | 61 ++--
 test/validation/api/crypto/test_vectors.h|  8 ++--
 2 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c 
b/test/validation/api/crypto/odp_crypto_test_inp.c
index b49cffb5a..0f10c4f49 100644
--- a/test/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/validation/api/crypto/odp_crypto_test_inp.c
@@ -79,6 +79,7 @@ static int alg_op(odp_packet_t pkt,
  odp_bool_t *ok,
  odp_crypto_session_t session,
  uint8_t *op_iv_ptr,
+ uint8_t *op_auth_iv_ptr,
  odp_packet_data_range_t *cipher_range,
  odp_packet_data_range_t *auth_range,
  uint8_t *aad,
@@ -99,8 +100,10 @@ static int alg_op(odp_packet_t pkt,
 
op_params.cipher_range = *cipher_range;
op_params.auth_range = *auth_range;
-   if (op_iv_ptr)
+   if (op_iv_ptr) {
op_params.override_iv_ptr = op_iv_ptr;
+   op_params.override_auth_iv_ptr = op_auth_iv_ptr;
+   }
 
op_params.aad_ptr = aad;
 
@@ -154,6 +157,7 @@ static int alg_packet_op(odp_packet_t pkt,
 odp_bool_t *ok,
 odp_crypto_session_t session,
 uint8_t *op_iv_ptr,
+uint8_t *op_auth_iv_ptr,
 odp_packet_data_range_t *cipher_range,
 odp_packet_data_range_t *auth_range,
 uint8_t *aad,
@@ -171,8 +175,10 @@ static int alg_packet_op(odp_packet_t pkt,
 
op_params.cipher_range = *cipher_range;
op_params.auth_range = *auth_range;
-   if (op_iv_ptr)
+   if (op_iv_ptr) {
op_params.override_iv_ptr = op_iv_ptr;
+   op_params.override_auth_iv_ptr = op_auth_iv_ptr;
+   }
 
op_params.aad_ptr = aad;
 
@@ -211,6 +217,7 @@ static int alg_packet_op_enq(odp_packet_t pkt,
 odp_bool_t *ok,
 odp_crypto_session_t session,
 uint8_t *op_iv_ptr,
+uint8_t *op_auth_iv_ptr,
 odp_packet_data_range_t *cipher_range,
 odp_packet_data_range_t *auth_range,
 uint8_t *aad,
@@ -229,8 +236,10 @@ static int alg_packet_op_enq(odp_packet_t pkt,
 
op_params.cipher_range = *cipher_range;
op_params.auth_range = *auth_range;
-   if (op_iv_ptr)
+   if (op_iv_ptr) {
op_params.override_iv_ptr = op_iv_ptr;
+   op_params.override_auth_iv_ptr = op_auth_iv_ptr;
+   }
 
op_params.aad_ptr = aad;
 
@@ -321,6 +330,10 @@ static void alg_test(odp_crypto_op_t op,
.data = ovr_iv ? NULL : ref->iv,
.length = ref->iv_length
};
+   odp_crypto_iv_t auth_iv = {
+   .data = ovr_iv ? NULL : ref->auth_iv,
+   .length = ref->auth_iv_length
+   };
int num, i;
int found;
 
@@ -414,6 +427,7 @@ static void alg_test(odp_crypto_op_t op,
/* Search for the test case */
for (i = 0; i < num; i++) {
if (auth_capa[i].digest_len == ref->digest_length &&
+   auth_capa[i].iv_len == auth_iv.length &&
auth_capa[i].key_len== auth_key.length) {
found = 1;
break;
@@ -422,8 +436,9 @@ static void alg_test(odp_crypto_op_t op,
 
if (!found) {
printf("\nUnsupported: alg=%s, key_len=%" PRIu32 ", "
-  "digest_len=%" PRIu32 "\n", auth_alg_name(auth_alg),
-  auth_key.length, ref->digest_length);
+  "digest_len=%" PRIu32 ", iv_len=%" PRIu32 "\n",
+  auth_alg_name(auth_alg), auth_key.length,
+  ref->digest_length, auth_iv.length);
return;
}
 
@@ -439,6 +454,7 @@ static void alg_test(odp_crypto_op_t op,
ses_params.output_pool = suite_context.pool;
ses_params.cipher_key = cipher_key;
ses_params.cipher_iv = iv;
+   ses_params.auth_iv = auth_iv;
ses_params.auth_key = auth_key;
ses_params.auth_digest_len = ref->digest_length;
ses_params.auth_aad_len = ref->aad_length;
@@ -489,16 +505,19 @@ static void alg_test(odp_crypto_op_t 

[lng-odp] [PATCH API-NEXT v5 6/6] linux-gen: crypto, ipsec: use auth_iv.

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Separate handling of authentication IV data.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 352 (lumag:crypto_gmac_iv)
 ** https://github.com/Linaro/odp/pull/352
 ** Patch: https://github.com/Linaro/odp/pull/352.patch
 ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4
 ** Merge commit sha: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23
 **/
 platform/linux-generic/odp_crypto.c| 35 ++
 platform/linux-generic/odp_ipsec.c |  6 --
 platform/linux-generic/odp_ipsec_sad.c |  2 +-
 3 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 2cf0f5c10..f42b7e182 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -36,9 +36,7 @@
  * Keep sorted: first by key length, then by IV length
  */
 static const odp_crypto_cipher_capability_t cipher_capa_null[] = {
-{.key_len = 0, .iv_len = 0},
-/* Special case for GMAC */
-{.key_len = 0, .iv_len = 12} };
+{.key_len = 0, .iv_len = 0} };
 
 static const odp_crypto_cipher_capability_t cipher_capa_trides_cbc[] = {
 {.key_len = 24, .iv_len = 8} };
@@ -86,7 +84,8 @@ static const odp_crypto_auth_capability_t auth_capa_aes_gcm[] 
= {
 {.digest_len = 16, .key_len = 0, .aad_len = {.min = 8, .max = 12, .inc = 4} } 
};
 
 static const odp_crypto_auth_capability_t auth_capa_aes_gmac[] = {
-{.digest_len = 16, .key_len = 16, .aad_len = {.min = 0, .max = 0, .inc = 0} } 
};
+{.digest_len = 16, .key_len = 16, .aad_len = {.min = 0, .max = 0, .inc = 0},
+   .iv_len = 12 } };
 
 /** Forward declaration of session structure */
 typedef struct odp_crypto_generic_session_t odp_crypto_generic_session_t;
@@ -121,6 +120,7 @@ struct odp_crypto_generic_session_t {
 
struct {
uint8_t  key[EVP_MAX_KEY_LENGTH];
+   uint8_t  iv_data[EVP_MAX_IV_LENGTH];
uint32_t key_length;
uint32_t bytes;
union {
@@ -640,10 +640,10 @@ odp_crypto_alg_err_t aes_gmac_gen(odp_packet_t pkt,
uint8_t block[EVP_MAX_MD_SIZE];
int ret;
 
-   if (param->override_iv_ptr)
-   iv_ptr = param->override_iv_ptr;
-   else if (session->p.cipher_iv.data)
-   iv_ptr = session->cipher.iv_data;
+   if (param->override_auth_iv_ptr)
+   iv_ptr = param->override_auth_iv_ptr;
+   else if (session->p.auth_iv.data)
+   iv_ptr = session->auth.iv_data;
else
return ODP_CRYPTO_ALG_ERR_IV_INVALID;
 
@@ -679,10 +679,10 @@ odp_crypto_alg_err_t aes_gmac_check(odp_packet_t pkt,
uint8_t block[EVP_MAX_MD_SIZE];
int ret;
 
-   if (param->override_iv_ptr)
-   iv_ptr = param->override_iv_ptr;
-   else if (session->p.cipher_iv.data)
-   iv_ptr = session->cipher.iv_data;
+   if (param->override_auth_iv_ptr)
+   iv_ptr = param->override_auth_iv_ptr;
+   else if (session->p.auth_iv.data)
+   iv_ptr = session->auth.iv_data;
else
return ODP_CRYPTO_ALG_ERR_IV_INVALID;
 
@@ -908,11 +908,21 @@ odp_crypto_session_create(odp_crypto_session_param_t 
*param,
goto err;
}
 
+   if (session->p.auth_iv.length > EVP_MAX_IV_LENGTH) {
+   ODP_DBG("Maximum auth IV length exceeded\n");
+   *status = ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
+   goto err;
+   }
+
/* Copy IV data */
if (session->p.cipher_iv.data)
memcpy(session->cipher.iv_data, session->p.cipher_iv.data,
   session->p.cipher_iv.length);
 
+   if (session->p.auth_iv.data)
+   memcpy(session->auth.iv_data, session->p.auth_iv.data,
+  session->p.auth_iv.length);
+
/* Derive order */
if (ODP_CRYPTO_OP_ENCODE == param->op)
session->do_cipher_first =  param->auth_cipher_text;
@@ -1101,6 +,7 @@ odp_crypto_operation(odp_crypto_op_param_t *param,
 
packet_param.session = param->session;
packet_param.override_iv_ptr = param->override_iv_ptr;
+   packet_param.override_auth_iv_ptr = param->override_auth_iv_ptr;
packet_param.hash_result_offset = param->hash_result_offset;
packet_param.aad_ptr = param->aad_ptr;
packet_param.cipher_range = param->cipher_range;
diff --git a/platform/linux-generic/odp_ipsec.c 
b/platform/linux-generic/odp_ipsec.c
index b023d308d..d8c8fc0f0 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -478,6 +478,7 @@ static int ipsec_in_esp(odp_packet_t *pkt,
state->in.hdr_len -
ipsec_sa->icv_len;
param->override_iv_ptr = state->iv;
+   param->override_auth_iv_ptr = 

Re: [lng-odp] [PATCH v11] Misc fixes

2018-01-03 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

test/validation/api/time/time.c
@@ -436,12 +436,12 @@ static void time_test_accuracy(time_cb time_cur, 
time_from_ns_cb time_from_ns)
wait = odp_time_sum(wait, sec);
}
 
+   c2 = time(NULL);
t2 = time_cur();
-   c2 = clock();
 
diff  = odp_time_diff(t2, t1);
sec_t = ((double)odp_time_to_ns(diff)) / ODP_TIME_SEC_IN_NS;
-   sec_c = ((double)(c2 - c1)) / CLOCKS_PER_SEC;
+   sec_c = ((double)(c2 - c1));


Comment:
I will change that to `gettimeofday()`. 

> Petri Savolainen(psavol) wrote:
> time_t is an integer value of seconds, right? sec_c is the reference that we 
> compare ODP time measurement against. Test passes if ODP measures within +-5% 
> the reference. Usage of time() change the reference to be very coarse grained 
> (e.g. 4, 5 or 6 sec), while the real time spent on the wait loop may be e.g. 
> 5.453 sec and ODP may measure 5.461 sec and the time() measures just 5.0 sec. 
> So, test result would be "fail" (5.461 vs 5.0) although ODP measurement error 
> was only+0.14% (5.461 vs 5.453).


>> Dmitry Eremin-Solenikov(lumag) wrote:
>> Well, no. Please recheck. I will update description to mention that is means 
>> static linking of libodp-linux into examples.


>>> muvarov wrote
>>> At his time if --disable-static-link is specified then linking is static. 
>>> If it's not specified that it's dynamic. I'm looking on odp_generator.


https://github.com/Linaro/odp/pull/377#discussion_r159528690
updated_at 2018-01-03 21:54:54


[lng-odp] [PATCH v1 1/4] validation: crypto: print untested capabilities

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Print all capability variants that were not covered by reference tests.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 379 (lumag:crypto-untested)
 ** https://github.com/Linaro/odp/pull/379
 ** Patch: https://github.com/Linaro/odp/pull/379.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 36b032fa07bb9b29a0c8f774c2ce76da96b4d653
 **/
 test/validation/api/crypto/odp_crypto_test_inp.c | 712 ++-
 1 file changed, 317 insertions(+), 395 deletions(-)

diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c 
b/test/validation/api/crypto/odp_crypto_test_inp.c
index 821bdc7e4..ddbad3097 100644
--- a/test/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/validation/api/crypto/odp_crypto_test_inp.c
@@ -299,14 +299,11 @@ static void alg_test(odp_crypto_op_t op,
 odp_bool_t ovr_iv)
 {
odp_crypto_session_t session;
-   odp_crypto_capability_t capa;
int rc;
odp_crypto_ses_create_err_t status;
odp_bool_t ok = false;
int iteration;
odp_crypto_session_param_t ses_params;
-   odp_crypto_cipher_capability_t cipher_capa[MAX_ALG_CAPA];
-   odp_crypto_auth_capability_t   auth_capa[MAX_ALG_CAPA];
odp_packet_data_range_t cipher_range;
odp_packet_data_range_t auth_range;
odp_crypto_key_t cipher_key = {
@@ -321,111 +318,6 @@ static void alg_test(odp_crypto_op_t op,
.data = ovr_iv ? NULL : ref->iv,
.length = ref->iv_length
};
-   int num, i;
-   int found;
-
-   rc = odp_crypto_capability();
-   CU_ASSERT(!rc);
-
-   if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC &&
-   !(capa.ciphers.bit.trides_cbc))
-   rc = -1;
-   if (cipher_alg == ODP_CIPHER_ALG_AES_CBC &&
-   !(capa.ciphers.bit.aes_cbc))
-   rc = -1;
-   if (cipher_alg == ODP_CIPHER_ALG_AES_CTR &&
-   !(capa.ciphers.bit.aes_ctr))
-   rc = -1;
-   if (cipher_alg == ODP_CIPHER_ALG_AES_GCM &&
-   !(capa.ciphers.bit.aes_gcm))
-   rc = -1;
-   if (cipher_alg == ODP_CIPHER_ALG_DES &&
-   !(capa.ciphers.bit.des))
-   rc = -1;
-   if (cipher_alg == ODP_CIPHER_ALG_NULL &&
-   !(capa.ciphers.bit.null))
-   rc = -1;
-
-   CU_ASSERT(!rc);
-   CU_ASSERT((~capa.ciphers.all_bits & capa.hw_ciphers.all_bits) == 0);
-
-   if (auth_alg == ODP_AUTH_ALG_AES_GCM &&
-   !(capa.auths.bit.aes_gcm))
-   rc = -1;
-   if (auth_alg == ODP_AUTH_ALG_AES_GMAC &&
-   !(capa.auths.bit.aes_gmac))
-   rc = -1;
-   if (auth_alg == ODP_AUTH_ALG_MD5_HMAC &&
-   !(capa.auths.bit.md5_hmac))
-   rc = -1;
-   if (auth_alg == ODP_AUTH_ALG_NULL &&
-   !(capa.auths.bit.null))
-   rc = -1;
-   if (auth_alg == ODP_AUTH_ALG_SHA1_HMAC &&
-   !(capa.auths.bit.sha1_hmac))
-   rc = -1;
-   if (auth_alg == ODP_AUTH_ALG_SHA256_HMAC &&
-   !(capa.auths.bit.sha256_hmac))
-   rc = -1;
-   if (auth_alg == ODP_AUTH_ALG_SHA512_HMAC &&
-   !(capa.auths.bit.sha512_hmac))
-   rc = -1;
-
-   CU_ASSERT(!rc);
-   CU_ASSERT((~capa.auths.all_bits & capa.hw_auths.all_bits) == 0);
-
-   num = odp_crypto_cipher_capability(cipher_alg, cipher_capa,
-  MAX_ALG_CAPA);
-
-   CU_ASSERT(num > 0);
-   found = 0;
-
-   CU_ASSERT(num <= MAX_ALG_CAPA);
-
-   if (num > MAX_ALG_CAPA)
-   num = MAX_ALG_CAPA;
-
-   /* Search for the test case */
-   for (i = 0; i < num; i++) {
-   if (cipher_capa[i].key_len == cipher_key.length &&
-   cipher_capa[i].iv_len  == iv.length) {
-   found = 1;
-   break;
-   }
-   }
-
-   if (!found) {
-   printf("\nUnsupported: alg=%s, key_len=%" PRIu32 ", "
-  "iv_len=%" PRIu32 "\n", cipher_alg_name(cipher_alg),
-  cipher_key.length, iv.length);
-   return;
-   }
-
-   num = odp_crypto_auth_capability(auth_alg, auth_capa, MAX_ALG_CAPA);
-
-   CU_ASSERT(num > 0);
-   found = 0;
-
-   CU_ASSERT(num <= MAX_ALG_CAPA);
-
-   if (num > MAX_ALG_CAPA)
-   num = MAX_ALG_CAPA;
-
-   /* Search for the test case */
-   for (i = 0; i < num; i++) {
-   if (auth_capa[i].digest_len == ref->digest_length &&
-   auth_capa[i].key_len== auth_key.length) {
-   found = 1;
-   break;
-   }
-   }
-
-   if (!found) {
-   printf("\nUnsupported: alg=%s, key_len=%" PRIu32 ", "
-  

[lng-odp] [PATCH v1 2/4] validation: crypto: add test vectors for full HMAC length

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

for HMAC tests add test vectors covering full HMAC length in addition to
truncated tests.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 379 (lumag:crypto-untested)
 ** https://github.com/Linaro/odp/pull/379
 ** Patch: https://github.com/Linaro/odp/pull/379.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 36b032fa07bb9b29a0c8f774c2ce76da96b4d653
 **/
 test/validation/api/crypto/test_vectors.h | 251 +-
 test/validation/api/crypto/test_vectors_len.h |   6 +-
 2 files changed, 254 insertions(+), 3 deletions(-)

diff --git a/test/validation/api/crypto/test_vectors.h 
b/test/validation/api/crypto/test_vectors.h
index f2ce9eb2f..6592a3357 100644
--- a/test/validation/api/crypto/test_vectors.h
+++ b/test/validation/api/crypto/test_vectors.h
@@ -486,7 +486,7 @@ static crypto_test_reference_t hmac_md5_reference[] = {
.ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
.digest_length = HMAC_MD5_96_CHECK_LEN,
.digest = { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c,
-   0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d },
+   0x13, 0xf4, 0x8e, 0xf8 },
 
},
{
@@ -505,7 +505,7 @@ static crypto_test_reference_t hmac_md5_reference[] = {
0x69, 0x6e, 0x67, 0x3f },
.digest_length = HMAC_MD5_96_CHECK_LEN,
.digest = { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03,
-   0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 },
+   0xea, 0xa8, 0x6e, 0x31 },
 
},
{
@@ -528,6 +528,61 @@ static crypto_test_reference_t hmac_md5_reference[] = {
0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
0xdd, 0xdd },
.digest_length = HMAC_MD5_96_CHECK_LEN,
+   .digest = { 0x56, 0xbe, 0x34, 0x52, 0x1d, 0x14, 0x4c, 0x88,
+   0xdb, 0xb8, 0xc7, 0x33 }
+   },
+   {
+   .auth_key_length = HMAC_MD5_KEY_LEN,
+   .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b },
+   .length = 8,
+   /* "Hi There" */
+   .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+   .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+   .digest_length = HMAC_MD5_CHECK_LEN,
+   .digest = { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c,
+   0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d },
+
+   },
+   {
+   .auth_key_length = HMAC_MD5_KEY_LEN,
+   /* "Jefe" */
+   .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
+   .length = 28,
+   /* what do ya want for nothing?*/
+   .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+  0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+  0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+  0x69, 0x6e, 0x67, 0x3f },
+   .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+   0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+   0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+   0x69, 0x6e, 0x67, 0x3f },
+   .digest_length = HMAC_MD5_CHECK_LEN,
+   .digest = { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03,
+   0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 },
+
+   },
+   {
+   .auth_key_length = HMAC_MD5_KEY_LEN,
+   .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa },
+   .length = 50,
+   .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+  0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+  0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+  0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+  0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+  0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+  0xdd, 0xdd },
+   .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+   0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+   0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+   0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 

[lng-odp] [PATCH API-NEXT v5 3/6] api: crypto: use cipher_iv instead of iv in session params

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

In preparation to add auth-specific IV, rename iv field to ciper_iv.
Provide deprecated compatibility field iv.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 352 (lumag:crypto_gmac_iv)
 ** https://github.com/Linaro/odp/pull/352
 ** Patch: https://github.com/Linaro/odp/pull/352.patch
 ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4
 ** Merge commit sha: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23
 **/
 example/ipsec/odp_ipsec_cache.c  | 14 +--
 include/odp/api/spec/crypto.h|  8 +-
 platform/linux-generic/odp_crypto.c  | 32 
 platform/linux-generic/odp_ipsec_sad.c   |  6 ++---
 test/performance/odp_crypto.c|  4 +--
 test/validation/api/crypto/odp_crypto_test_inp.c |  2 +-
 6 files changed, 36 insertions(+), 30 deletions(-)

diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
index bd4c1eabc..220df7825 100644
--- a/example/ipsec/odp_ipsec_cache.c
+++ b/example/ipsec/odp_ipsec_cache.c
@@ -92,13 +92,13 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
params.cipher_alg  = cipher_sa->alg.u.cipher;
params.cipher_key.data  = cipher_sa->key.data;
params.cipher_key.length  = cipher_sa->key.length;
-   params.iv.data = entry->state.iv;
-   params.iv.length = cipher_sa->iv_len;
+   params.cipher_iv.data = entry->state.iv;
+   params.cipher_iv.length = cipher_sa->iv_len;
mode = cipher_sa->mode;
} else {
params.cipher_alg = ODP_CIPHER_ALG_NULL;
-   params.iv.data = NULL;
-   params.iv.length = 0;
+   params.cipher_iv.data = NULL;
+   params.cipher_iv.length = 0;
}
 
/* Auth */
@@ -113,10 +113,10 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
}
 
/* Generate an IV */
-   if (params.iv.length) {
-   int32_t size = params.iv.length;
+   if (params.cipher_iv.length) {
+   int32_t size = params.cipher_iv.length;
 
-   int32_t ret = odp_random_data(params.iv.data, size, 1);
+   int32_t ret = odp_random_data(params.cipher_iv.data, size, 1);
if (ret != size)
return -1;
}
diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index 81fecbc36..25ce2f86c 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -313,7 +313,13 @@ typedef struct odp_crypto_session_param_t {
odp_crypto_key_t cipher_key;
 
/** Cipher Initialization Vector (IV) */
-   odp_crypto_iv_t iv;
+   union {
+   /** @deprecated Use cipher_iv */
+   odp_crypto_iv_t ODP_DEPRECATE(iv);
+
+   /** Cipher Initialization Vector (IV) */
+   odp_crypto_iv_t cipher_iv;
+   };
 
/** Authentication algorithm
 *
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 3b110c191..2cf0f5c10 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -436,7 +436,7 @@ odp_crypto_alg_err_t cipher_encrypt(odp_packet_t pkt,
 
if (param->override_iv_ptr)
iv_ptr = param->override_iv_ptr;
-   else if (session->p.iv.data)
+   else if (session->p.cipher_iv.data)
iv_ptr = session->cipher.iv_data;
else
return ODP_CRYPTO_ALG_ERR_IV_INVALID;
@@ -467,7 +467,7 @@ odp_crypto_alg_err_t cipher_decrypt(odp_packet_t pkt,
 
if (param->override_iv_ptr)
iv_ptr = param->override_iv_ptr;
-   else if (session->p.iv.data)
+   else if (session->p.cipher_iv.data)
iv_ptr = session->cipher.iv_data;
else
return ODP_CRYPTO_ALG_ERR_IV_INVALID;
@@ -496,8 +496,8 @@ static int 
process_cipher_param(odp_crypto_generic_session_t *session,
return -1;
 
/* Verify IV len is correct */
-   if (!((0 == session->p.iv.length) ||
- ((uint32_t)EVP_CIPHER_iv_length(cipher) == session->p.iv.length)))
+   if (!((0 == session->p.cipher_iv.length) ||
+ ((uint32_t)EVP_CIPHER_iv_length(cipher) == 
session->p.cipher_iv.length)))
return -1;
 
session->cipher.evp_cipher = cipher;
@@ -529,7 +529,7 @@ odp_crypto_alg_err_t aes_gcm_encrypt(odp_packet_t pkt,
 
if (param->override_iv_ptr)
iv_ptr = param->override_iv_ptr;
-   else if (session->p.iv.data)
+   else if (session->p.cipher_iv.data)
iv_ptr = session->cipher.iv_data;
else
return ODP_CRYPTO_ALG_ERR_IV_INVALID;
@@ -539,7 +539,7 @@ odp_crypto_alg_err_t aes_gcm_encrypt(odp_packet_t 

[lng-odp] [PATCH API-NEXT v5 4/6] api: crypto: add separate auth IV

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

GMAC auth algorithm requires IV to work. Instead of hacking the
ODP_CIPHER_ALG_NULL iv to include value for ODP_AUTH_ALG_GMAC, provide
separate iv (in auth capability, session params and operation params).

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 352 (lumag:crypto_gmac_iv)
 ** https://github.com/Linaro/odp/pull/352
 ** Patch: https://github.com/Linaro/odp/pull/352.patch
 ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4
 ** Merge commit sha: 5a1e35f8e8d8df2bc17b098f7c9c92611ea98e23
 **/
 include/odp/api/spec/crypto.h | 12 
 1 file changed, 12 insertions(+)

diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index 25ce2f86c..99ae4576a 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -333,6 +333,9 @@ typedef struct odp_crypto_session_param_t {
 */
odp_crypto_key_t auth_key;
 
+   /** Authentication Initialization Vector (IV) */
+   odp_crypto_iv_t auth_iv;
+
/** Authentication digest length in bytes
 *
 *  Use odp_crypto_auth_capability() for supported digest lengths.
@@ -403,6 +406,9 @@ typedef struct odp_crypto_op_param_t {
/** Override session IV pointer */
uint8_t *override_iv_ptr;
 
+   /** Override session authentication IV pointer */
+   uint8_t *override_auth_iv_ptr;
+
/** Offset from start of packet for hash result
 *
 *  Specifies the offset where the hash result is to be stored. In case
@@ -439,6 +445,9 @@ typedef struct odp_crypto_packet_op_param_t {
/** Override session IV pointer */
uint8_t *override_iv_ptr;
 
+   /** Override session authentication IV pointer */
+   uint8_t *override_auth_iv_ptr;
+
/** Offset from start of packet for hash result
 *
 *  Specifies the offset where the hash result is to be stored. In case
@@ -604,6 +613,9 @@ typedef struct odp_crypto_auth_capability_t {
/** Key length in bytes */
uint32_t key_len;
 
+   /** IV length in bytes */
+   uint32_t iv_len;
+
/** Additional Authenticated Data (AAD) lengths */
struct {
/** Minimum AAD length in bytes */



[lng-odp] [PATCH v1 3/4] validation: crypto: fail if no tests were executed

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Fail the test if we were not able to match any test vectors to
capabilities.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 379 (lumag:crypto-untested)
 ** https://github.com/Linaro/odp/pull/379
 ** Patch: https://github.com/Linaro/odp/pull/379.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 36b032fa07bb9b29a0c8f774c2ce76da96b4d653
 **/
 test/validation/api/crypto/odp_crypto_test_inp.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c 
b/test/validation/api/crypto/odp_crypto_test_inp.c
index ddbad3097..8d1489ae6 100644
--- a/test/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/validation/api/crypto/odp_crypto_test_inp.c
@@ -437,6 +437,8 @@ static void check_alg(odp_crypto_op_t op,
int rc, cipher_num, auth_num, i;
odp_bool_t cipher_tested[MAX_ALG_CAPA];
odp_bool_t auth_tested[MAX_ALG_CAPA];
+   odp_bool_t cipher_ok = false;
+   odp_bool_t auth_ok = false;
size_t idx;
 
rc = odp_crypto_capability();
@@ -555,21 +557,29 @@ static void check_alg(odp_crypto_op_t op,
auth_tested[auth_idx] = true;
}
 
-   for (i = 0; i < cipher_num; i++)
+   for (i = 0; i < cipher_num; i++) {
+   cipher_ok |= cipher_tested[i];
if (!cipher_tested[i])
printf("\nUntested: alg=%s, key_len=%" PRIu32 ", "
   "iv_len=%" PRIu32 "\n",
   cipher_alg_name(cipher_alg),
   cipher_capa[i].key_len,
   cipher_capa[i].iv_len);
+   }
 
-   for (i = 0; i < auth_num; i++)
+   for (i = 0; i < auth_num; i++) {
+   auth_ok |= auth_tested[i];
if (!auth_tested[i])
printf("\nUntested: alg=%s, key_len=%" PRIu32 ", "
   "digest_len=%" PRIu32 "\n",
   auth_alg_name(auth_alg),
   auth_capa[i].key_len,
   auth_capa[i].digest_len);
+   }
+
+   /* Verify that we were able to run at least several tests */
+   CU_ASSERT(cipher_ok);
+   CU_ASSERT(auth_ok);
 }
 
 /**



[lng-odp] [PATCH v11 0/13] Misc fixes

2018-01-03 Thread Github ODP bot
Several small fixes produced while working on updating ODP packaging.

github
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 13 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 12 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 14 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 8 lines checked


to_send-p-003.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 7 lines checked


to_send-p-004.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 22 lines checked


to_send-p-005.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 27 lines checked


to_send-p-006.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 48 lines checked


to_send-p-007.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 125 lines checked


to_send-p-008.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 45 lines checked


to_send-p-009.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 7 lines checked


to_send-p-010.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 6 lines checked


to_send-p-011.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 124 lines checked


to_send-p-012.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH v11 4/13] performance: odp_crypto: correct typo

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Receieved -> Received.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 test/performance/odp_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c
index 0cbc2754e..761cc8cff 100644
--- a/test/performance/odp_crypto.c
+++ b/test/performance/odp_crypto.c
@@ -612,7 +612,7 @@ run_measure_one(crypto_args_t *cargs,
 
if (cargs->debug_packets) {
mem = odp_packet_data(out_pkt);
-   print_mem("Receieved encrypted packet",
+   print_mem("Received encrypted packet",
  mem,
  payload_length +
  config->



[lng-odp] [PATCH v11 13/13] example: ipsec_api: remove file conflict with ipsec example

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

ipsec_api example installs program with the same name, as ipsec example
does. Remove file conflict between two examples.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 example/ipsec_api/Makefile.am  | 27 +++---
 ...sec_run_ah_in.sh => odp_ipsec_api_run_ah_in.sh} |  2 +-
 ...c_run_ah_out.sh => odp_ipsec_api_run_ah_out.sh} |  2 +-
 ...ah_tun_in.sh => odp_ipsec_api_run_ah_tun_in.sh} |  2 +-
 ..._tun_out.sh => odp_ipsec_api_run_ah_tun_out.sh} |  2 +-
 ...c_run_esp_in.sh => odp_ipsec_api_run_esp_in.sh} |  2 +-
 ...run_esp_out.sh => odp_ipsec_api_run_esp_out.sh} |  2 +-
 ...p_tun_in.sh => odp_ipsec_api_run_esp_tun_in.sh} |  2 +-
 ...tun_out.sh => odp_ipsec_api_run_esp_tun_out.sh} |  2 +-
 ...ipsec_run_live.sh => odp_ipsec_api_run_live.sh} |  2 +-
 ...c_run_router.sh => odp_ipsec_api_run_router.sh} |  2 +-
 ...c_run_simple.sh => odp_ipsec_api_run_simple.sh} |  2 +-
 12 files changed, 25 insertions(+), 24 deletions(-)
 rename example/ipsec_api/{odp_ipsec_run_ah_in.sh => 
odp_ipsec_api_run_ah_in.sh} (91%)
 rename example/ipsec_api/{odp_ipsec_run_ah_out.sh => 
odp_ipsec_api_run_ah_out.sh} (91%)
 rename example/ipsec_api/{odp_ipsec_run_ah_tun_in.sh => 
odp_ipsec_api_run_ah_tun_in.sh} (92%)
 rename example/ipsec_api/{odp_ipsec_run_ah_tun_out.sh => 
odp_ipsec_api_run_ah_tun_out.sh} (92%)
 rename example/ipsec_api/{odp_ipsec_run_esp_in.sh => 
odp_ipsec_api_run_esp_in.sh} (91%)
 rename example/ipsec_api/{odp_ipsec_run_esp_out.sh => 
odp_ipsec_api_run_esp_out.sh} (92%)
 rename example/ipsec_api/{odp_ipsec_run_esp_tun_in.sh => 
odp_ipsec_api_run_esp_tun_in.sh} (92%)
 rename example/ipsec_api/{odp_ipsec_run_esp_tun_out.sh => 
odp_ipsec_api_run_esp_tun_out.sh} (92%)
 rename example/ipsec_api/{odp_ipsec_run_live.sh => odp_ipsec_api_run_live.sh} 
(94%)
 rename example/ipsec_api/{odp_ipsec_run_router.sh => 
odp_ipsec_api_run_router.sh} (85%)
 rename example/ipsec_api/{odp_ipsec_run_simple.sh => 
odp_ipsec_api_run_simple.sh} (87%)

diff --git a/example/ipsec_api/Makefile.am b/example/ipsec_api/Makefile.am
index 14bc5dd66..848683e00 100644
--- a/example/ipsec_api/Makefile.am
+++ b/example/ipsec_api/Makefile.am
@@ -3,22 +3,23 @@ include $(top_srcdir)/example/Makefile.inc
 AM_CPPFLAGS = $(OPENSSL_CPPFLAGS)
 LDADD += $(OPENSSL_LIBS)
 
-bin_PROGRAMS = odp_ipsec
+bin_PROGRAMS = odp_ipsec_api
 
 dist_bin_SCRIPTS = \
-  $(srcdir)/odp_ipsec_run_ah_in.sh \
-  $(srcdir)/odp_ipsec_run_ah_out.sh \
-  $(srcdir)/odp_ipsec_run_ah_tun_in.sh \
-  $(srcdir)/odp_ipsec_run_ah_tun_out.sh \
-  $(srcdir)/odp_ipsec_run_esp_in.sh \
-  $(srcdir)/odp_ipsec_run_esp_out.sh \
-  $(srcdir)/odp_ipsec_run_esp_tun_in.sh \
-  $(srcdir)/odp_ipsec_run_esp_tun_out.sh \
-  $(srcdir)/odp_ipsec_run_live.sh \
-  $(srcdir)/odp_ipsec_run_router.sh \
-  $(srcdir)/odp_ipsec_run_simple.sh
+  $(srcdir)/odp_ipsec_api_run_ah_in.sh \
+  $(srcdir)/odp_ipsec_api_run_ah_out.sh \
+  $(srcdir)/odp_ipsec_api_run_ah_tun_in.sh \
+  $(srcdir)/odp_ipsec_api_run_ah_tun_out.sh \
+  $(srcdir)/odp_ipsec_api_run_esp_in.sh \
+  $(srcdir)/odp_ipsec_api_run_esp_out.sh \
+  $(srcdir)/odp_ipsec_api_run_esp_tun_in.sh \
+  $(srcdir)/odp_ipsec_api_run_esp_tun_out.sh \
+  $(srcdir)/odp_ipsec_api_run_live.sh \
+  $(srcdir)/odp_ipsec_api_run_router.sh \
+  $(srcdir)/odp_ipsec_api_run_simple.sh
 
-odp_ipsec_SOURCES = odp_ipsec.c \
+odp_ipsec_api_SOURCES = \
+   odp_ipsec.c \
odp_ipsec_sa_db.c \
odp_ipsec_sa_db.h \
odp_ipsec_sp_db.c \
diff --git a/example/ipsec_api/odp_ipsec_run_ah_in.sh 
b/example/ipsec_api/odp_ipsec_api_run_ah_in.sh
similarity index 91%
rename from example/ipsec_api/odp_ipsec_run_ah_in.sh
rename to example/ipsec_api/odp_ipsec_api_run_ah_in.sh
index c5b105f59..becfc8928 100755
--- a/example/ipsec_api/odp_ipsec_run_ah_in.sh
+++ b/example/ipsec_api/odp_ipsec_api_run_ah_in.sh
@@ -4,7 +4,7 @@
 #  - 2 loop interfaces
 #  - 10 packets
 #  - Specify API mode on command line
-odp_ipsec -i loop1,loop2 \
+odp_ipsec_api -i loop1,loop2 \
 -r 192.168.111.2/32:loop1:08.00.27.76.B5.E0 \
 -p 192.168.222.0/24:192.168.111.0/24:in:ah \
 -a 192.168.222.2:192.168.111.2:md5:300:27f6d123d7077b361662fc6e451f65d8 \
diff --git a/example/ipsec_api/odp_ipsec_run_ah_out.sh 

[lng-odp] [PATCH v1 4/4] validation: crypto: don't output untested cipher for NULL cipher

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

AES-GMAC adds synthetic NULL cipher capability with IV length = 12.
Skip CIPHER_ALG_NULL entries when printing untested messages (as
untested entry does not really mean a thing for NULL cipher algo).

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 379 (lumag:crypto-untested)
 ** https://github.com/Linaro/odp/pull/379
 ** Patch: https://github.com/Linaro/odp/pull/379.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 36b032fa07bb9b29a0c8f774c2ce76da96b4d653
 **/
 test/validation/api/crypto/odp_crypto_test_inp.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c 
b/test/validation/api/crypto/odp_crypto_test_inp.c
index 8d1489ae6..ad9784a69 100644
--- a/test/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/validation/api/crypto/odp_crypto_test_inp.c
@@ -559,12 +559,16 @@ static void check_alg(odp_crypto_op_t op,
 
for (i = 0; i < cipher_num; i++) {
cipher_ok |= cipher_tested[i];
-   if (!cipher_tested[i])
+   if (!cipher_tested[i]) {
+   /* GMAC-related hacks */
+   if (cipher_alg == ODP_CIPHER_ALG_NULL)
+   continue;
printf("\nUntested: alg=%s, key_len=%" PRIu32 ", "
   "iv_len=%" PRIu32 "\n",
   cipher_alg_name(cipher_alg),
   cipher_capa[i].key_len,
   cipher_capa[i].iv_len);
+   }
}
 
for (i = 0; i < auth_num; i++) {



[lng-odp] [PATCH v11 7/13] helper/tests: use common Makefile.inc for tests

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 helper/test/Makefile.am | 24 +---
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
index 8eee643be..662d6c758 100644
--- a/helper/test/Makefile.am
+++ b/helper/test/Makefile.am
@@ -1,26 +1,4 @@
-TESTS_ENVIRONMENT = EXEEXT=${EXEEXT}
-
-LIB   = $(top_builddir)/lib
-
-#in the following line, the libs using the symbols should come before
-#the libs containing them! The includer is given a chance to add things
-#before libodp by setting PRE_LDADD before the inclusion.
-LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp-linux.la
-
-INCFLAGS = \
-   -I$(top_builddir)/platform/@with_platform@/include \
-   -I$(top_srcdir)/helper/include \
-   -I$(top_srcdir)/include \
-   -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \
-   -I$(top_srcdir)/platform/@with_platform@/include \
-   -I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@ \
-   -I$(top_builddir)/include \
-   -I$(top_srcdir)/helper
-
-ODP_PLATFORM=${with_platform}
-
-AM_CPPFLAGS = $(INCFLAGS)
-AM_LDFLAGS = -static
+include $(top_srcdir)/test/Makefile.inc
 
 EXECUTABLES = chksum \
   cuckootable \



[lng-odp] [PATCH v11 10/13] validation: time: use gettimeofday() instead of clock()

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

ODP test for time API uses clock() to compare time against. However
clock() returns processor time used by program, which can differ between
runs. Use gettimeofday() as a time source to compare against.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 test/validation/api/time/time.c | 20 +++-
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/test/validation/api/time/time.c b/test/validation/api/time/time.c
index c8f90dbac..ccbc7e3ba 100644
--- a/test/validation/api/time/time.c
+++ b/test/validation/api/time/time.c
@@ -9,7 +9,7 @@
 #include 
 #include "odp_cunit_common.h"
 #include "time_test.h"
-#include 
+#include 
 
 #define BUSY_LOOP_CNT  3000/* used for t > min resolution */
 #define BUSY_LOOP_CNT_LONG 60  /* used for t > 4 sec */
@@ -423,11 +423,12 @@ static void time_test_accuracy(time_cb time_cur, 
time_from_ns_cb time_from_ns)
 {
int i;
odp_time_t t1, t2, wait, diff;
-   clock_t c1, c2;
+   struct timeval tv1, tv2, tvdiff;
double sec_t, sec_c;
odp_time_t sec = time_from_ns(ODP_TIME_SEC_IN_NS);
 
-   c1 = clock();
+   i = gettimeofday(, NULL);
+   CU_ASSERT(i == 0);
t1 = time_cur();
 
wait = odp_time_sum(t1, sec);
@@ -436,12 +437,21 @@ static void time_test_accuracy(time_cb time_cur, 
time_from_ns_cb time_from_ns)
wait = odp_time_sum(wait, sec);
}
 
+   i = gettimeofday(, NULL);
+   CU_ASSERT(i == 0);
t2 = time_cur();
-   c2 = clock();
+
+   if (tv2.tv_usec < tv1.tv_usec) {
+   tvdiff.tv_usec = 100 + tv2.tv_usec - tv1.tv_usec;
+   tvdiff.tv_sec = tv2.tv_sec - 1 - tv1.tv_sec;
+   } else {
+   tvdiff.tv_usec = tv2.tv_usec - tv1.tv_usec;
+   tvdiff.tv_sec = tv2.tv_sec - tv1.tv_sec;
+   }
 
diff  = odp_time_diff(t2, t1);
sec_t = ((double)odp_time_to_ns(diff)) / ODP_TIME_SEC_IN_NS;
-   sec_c = ((double)(c2 - c1)) / CLOCKS_PER_SEC;
+   sec_c = ((double)(tvdiff.tv_usec) / 100) + tvdiff.tv_sec;
 
/* Check that ODP time is within +-5% of system time */
CU_ASSERT(sec_t < sec_c * 1.05);



[lng-odp] [PATCH v11 8/13] test, linux-gen: use common test/Makefile.inc

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Populate test/Makefile.inc with more variables, allowing us to drop
platform test/Makefile.inc.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 platform/linux-generic/test/Makefile.inc   | 22 --
 platform/linux-generic/test/ring/Makefile.am   |  4 +---
 .../linux-generic/test/validation/Makefile.inc |  1 -
 .../linux-generic/test/validation/api/Makefile.inc |  2 +-
 .../test/validation/api/shmem/Makefile.am  |  6 --
 test/Makefile.inc  |  9 +
 test/validation/api/Makefile.inc   | 11 ---
 7 files changed, 11 insertions(+), 44 deletions(-)
 delete mode 100644 platform/linux-generic/test/Makefile.inc
 delete mode 100644 platform/linux-generic/test/validation/Makefile.inc

diff --git a/platform/linux-generic/test/Makefile.inc 
b/platform/linux-generic/test/Makefile.inc
deleted file mode 100644
index dd21917eb..0
--- a/platform/linux-generic/test/Makefile.inc
+++ /dev/null
@@ -1,22 +0,0 @@
-# The following definitions may be used by platform tests that wish to
-# build specific ODP applications, (i.e those whose do more than validation
-# test wrapping)
-
-AM_LDFLAGS = -static
-
-AM_CFLAGS = $(CUNIT_CFLAGS)
-
-LIBCUNIT_COMMON = $(top_builddir)/test/common/libcunit_common.la
-LIB   = $(top_builddir)/lib
-LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp-linux.la $(DPDK_PMDS)
-
-INCCUNIT_COMMON = -I$(top_srcdir)/test/common
-INCODP =  \
--I$(top_builddir)/include \
--I$(top_builddir)/platform/@with_platform@/include \
--I$(top_srcdir)/helper/include \
--I$(top_srcdir)/include \
--I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \
--I$(top_srcdir)/platform/@with_platform@/arch/$(ARCH_DIR) \
--I$(top_srcdir)/platform/@with_platform@/include \
--I$(top_srcdir)/test
diff --git a/platform/linux-generic/test/ring/Makefile.am 
b/platform/linux-generic/test/ring/Makefile.am
index 376047559..95e5e87f4 100644
--- a/platform/linux-generic/test/ring/Makefile.am
+++ b/platform/linux-generic/test/ring/Makefile.am
@@ -1,4 +1,4 @@
-include ../Makefile.inc
+include $(top_srcdir)/test/Makefile.inc
 
 test_PROGRAMS = ring_main
 ring_main_SOURCES = \
@@ -6,6 +6,4 @@ ring_main_SOURCES = \
ring_suites.c ring_suites.h \
ring_basic.c ring_stress.c
 
-ring_main_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/include \
-$(INCCUNIT_COMMON) $(INCODP)
 ring_main_LDADD = $(LIBCUNIT_COMMON) $(LIBODP)
diff --git a/platform/linux-generic/test/validation/Makefile.inc 
b/platform/linux-generic/test/validation/Makefile.inc
deleted file mode 100644
index b9030850c..0
--- a/platform/linux-generic/test/validation/Makefile.inc
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/platform/linux-generic/test/Makefile.inc
diff --git a/platform/linux-generic/test/validation/api/Makefile.inc 
b/platform/linux-generic/test/validation/api/Makefile.inc
index c47217d1a..cda6237ea 100644
--- a/platform/linux-generic/test/validation/api/Makefile.inc
+++ b/platform/linux-generic/test/validation/api/Makefile.inc
@@ -1 +1 @@
-include $(top_srcdir)/platform/linux-generic/test/validation/Makefile.inc
+include $(top_srcdir)/test/validation/api/Makefile.inc
diff --git a/platform/linux-generic/test/validation/api/shmem/Makefile.am 
b/platform/linux-generic/test/validation/api/shmem/Makefile.am
index 131a511be..f75cbc976 100644
--- a/platform/linux-generic/test/validation/api/shmem/Makefile.am
+++ b/platform/linux-generic/test/validation/api/shmem/Makefile.am
@@ -10,13 +10,7 @@ shmem_linux_LDFLAGS = $(AM_LDFLAGS) -lrt
 
 #shmem_odp1 and shmem_odp2 are the 2 ODP processes:
 shmem_odp1_SOURCES = shmem_odp1.c shmem_odp1.h shmem_common.h
-shmem_odp1_CFLAGS = $(AM_CFLAGS) \
-  $(INCCUNIT_COMMON) \
-  $(INCODP)
 shmem_odp1_LDADD = $(LIBCUNIT_COMMON) $(LIBODP)
 
 shmem_odp2_SOURCES = shmem_odp2.c shmem_odp2.h shmem_common.h
-shmem_odp2_CFLAGS = $(AM_CFLAGS) \
-  $(INCCUNIT_COMMON) \
-  $(INCODP)
 shmem_odp2_LDADD = $(LIBCUNIT_COMMON) $(LIBODP)
diff --git a/test/Makefile.inc b/test/Makefile.inc
index f7c0da214..d4d74c25e 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -1,5 +1,13 @@
 LIB   = $(top_builddir)/lib
 
+COMMON_DIR = $(top_builddir)/test/common
+
+LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp-linux.la
+
+LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.la
+LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.la
+LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.la
+
 #in the following line, 

[lng-odp] [PATCH v11 12/13] tests: don't use ODP_SYSCONFIG_FILE

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

libconfig is not used in TigerMoth, so let's drop the variable in
test's Makefile.inc.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 test/Makefile.inc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/test/Makefile.inc b/test/Makefile.inc
index 0b5b66dd0..192dab221 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -33,5 +33,4 @@ AM_LDFLAGS = -L$(LIB) -static
 @VALGRIND_CHECK_RULES@
 
 TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform} \
-   EXEEXT=${EXEEXT} \
-   ODP_SYSCONFIG_FILE=none
+   EXEEXT=${EXEEXT}



[lng-odp] [PATCH v11 1/13] helper: link against libpthread and libodp-linux

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

libodphelper.so uses symbols from libpthread and libodp-linux.so, link
it aganst those libraries.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 helper/Makefile.am | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/helper/Makefile.am b/helper/Makefile.am
index ee1c17d6d..ebb67346c 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -10,6 +10,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/platform/@with_platform@/include \
-I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@ \
-I$(top_builddir)/include
+AM_CFLAGS = $(PTHREAD_CFLAGS)
 
 AM_LDFLAGS = -version-number '$(ODPHELPER_LIBSO_VERSION)'
 
@@ -60,4 +61,6 @@ __LIB__libodphelper_la_SOURCES += \
linux/thread.c
 endif
 
+__LIB__libodphelper_la_LIBADD = $(PTHREAD_LIBS) $(LIB)/libodp-linux.la
+
 lib_LTLIBRARIES = $(LIB)/libodphelper.la



[lng-odp] [PATCH v11 2/13] doc: add missing user-guide images to Makefile.am

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Omitting those images in Makefile.am made them disappear from
distribution tarball resulting in an improperly-built documentation
files.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 doc/users-guide/Makefile.am | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/doc/users-guide/Makefile.am b/doc/users-guide/Makefile.am
index b2ebd4d4f..7be32ddc1 100644
--- a/doc/users-guide/Makefile.am
+++ b/doc/users-guide/Makefile.am
@@ -32,6 +32,12 @@ IMAGES = $(IMAGES_DIR)/overview.svg \
 $(IMAGES_DIR)/pktio_fsm.svg \
 $(IMAGES_DIR)/pktout_direct_send.svg \
 $(IMAGES_DIR)/pktout_queue_send.svg \
+$(IMAGES_DIR)/ref.svg \
+$(IMAGES_DIR)/refpkt1.svg \
+$(IMAGES_DIR)/refpkt2.svg \
+$(IMAGES_DIR)/refpktmulti.svg \
+$(IMAGES_DIR)/refpktsingle.svg \
+$(IMAGES_DIR)/refstatic.svg \
 $(IMAGES_DIR)/release_git.svg \
 $(IMAGES_DIR)/segment.svg \
 $(IMAGES_DIR)/simple_release_git.svg \



[lng-odp] [PATCH v11 11/13] linux-gen: don't use SYSCONFDIR

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

sysconfig is not used in TigerMoth, so let's drop the variable in
linux-gen's Makefile.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 platform/linux-generic/Makefile.am | 1 -
 1 file changed, 1 deletion(-)

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 7e40448bd..415e7b8b7 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -11,7 +11,6 @@ AM_CPPFLAGS +=  -I$(top_builddir)/include
 AM_CPPFLAGS +=  -Iinclude
 AM_CPPFLAGS +=  -I$(top_srcdir)/platform/$(with_platform)/arch/$(ARCH_DIR)
 AM_CPPFLAGS +=  -I$(top_srcdir)/platform/$(with_platform)/arch/default
-AM_CPPFLAGS +=  -DSYSCONFDIR=\"@sysconfdir@\"
 
 AM_CPPFLAGS +=  $(OPENSSL_CPPFLAGS)
 AM_CPPFLAGS +=  $(DPDK_CPPFLAGS)



[lng-odp] [PATCH v11 9/13] validation: stop overriding LDADD variable

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

LDADD variable can be used to pass other libraries (like DPDK). Stop
overriding LDADD entirely. Instead use PRELDADD variable or appending to
LDADD.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 platform/linux-generic/test/ring/Makefile.am | 2 +-
 platform/linux-generic/test/validation/api/shmem/Makefile.am | 3 +--
 test/Makefile.inc| 5 +++--
 test/validation/api/Makefile.inc | 1 +
 test/validation/api/atomic/Makefile.am   | 1 -
 test/validation/api/barrier/Makefile.am  | 1 -
 test/validation/api/buffer/Makefile.am   | 1 -
 test/validation/api/chksum/Makefile.am   | 1 -
 test/validation/api/classification/Makefile.am   | 1 -
 test/validation/api/cpumask/Makefile.am  | 2 +-
 test/validation/api/crypto/Makefile.am   | 1 -
 test/validation/api/errno/Makefile.am| 1 -
 test/validation/api/event/Makefile.am| 1 -
 test/validation/api/hash/Makefile.am | 1 -
 test/validation/api/init/Makefile.am | 3 ---
 test/validation/api/ipsec/Makefile.am| 5 +
 test/validation/api/lock/Makefile.am | 1 -
 test/validation/api/packet/Makefile.am   | 1 -
 test/validation/api/pktio/Makefile.am| 1 -
 test/validation/api/pool/Makefile.am | 1 -
 test/validation/api/queue/Makefile.am| 1 -
 test/validation/api/random/Makefile.am   | 1 -
 test/validation/api/scheduler/Makefile.am| 1 -
 test/validation/api/shmem/Makefile.am| 1 -
 test/validation/api/std_clib/Makefile.am | 1 -
 test/validation/api/system/Makefile.am   | 1 -
 test/validation/api/thread/Makefile.am   | 2 +-
 test/validation/api/time/Makefile.am | 1 -
 test/validation/api/timer/Makefile.am| 1 -
 test/validation/api/traffic_mngr/Makefile.am | 2 +-
 30 files changed, 10 insertions(+), 36 deletions(-)

diff --git a/platform/linux-generic/test/ring/Makefile.am 
b/platform/linux-generic/test/ring/Makefile.am
index 95e5e87f4..8287c7e04 100644
--- a/platform/linux-generic/test/ring/Makefile.am
+++ b/platform/linux-generic/test/ring/Makefile.am
@@ -6,4 +6,4 @@ ring_main_SOURCES = \
ring_suites.c ring_suites.h \
ring_basic.c ring_stress.c
 
-ring_main_LDADD = $(LIBCUNIT_COMMON) $(LIBODP)
+PRELDADD += $(LIBCUNIT_COMMON)
diff --git a/platform/linux-generic/test/validation/api/shmem/Makefile.am 
b/platform/linux-generic/test/validation/api/shmem/Makefile.am
index f75cbc976..07d311d2f 100644
--- a/platform/linux-generic/test/validation/api/shmem/Makefile.am
+++ b/platform/linux-generic/test/validation/api/shmem/Makefile.am
@@ -7,10 +7,9 @@ test_PROGRAMS = shmem_linux shmem_odp1 shmem_odp2
 shmem_linux_SOURCES = shmem_linux.c shmem_linux.h shmem_common.h
 shmem_linux_CFLAGS = $(AM_CFLAGS) -I$(top_builddir)/include
 shmem_linux_LDFLAGS = $(AM_LDFLAGS) -lrt
+shmem_linux_LDADD =
 
 #shmem_odp1 and shmem_odp2 are the 2 ODP processes:
 shmem_odp1_SOURCES = shmem_odp1.c shmem_odp1.h shmem_common.h
-shmem_odp1_LDADD = $(LIBCUNIT_COMMON) $(LIBODP)
 
 shmem_odp2_SOURCES = shmem_odp2.c shmem_odp2.h shmem_common.h
-shmem_odp2_LDADD = $(LIBCUNIT_COMMON) $(LIBODP)
diff --git a/test/Makefile.inc b/test/Makefile.inc
index d4d74c25e..0b5b66dd0 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -10,8 +10,9 @@ LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.la
 
 #in the following line, the libs using the symbols should come before
 #the libs containing them! The includer is given a chance to add things
-#before libodp by setting PRE_LDADD before the inclusion.
-LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp-linux.la $(DPDK_PMDS)
+#before libodp by setting PRELDADD before the inclusion.
+LDADD = $(PRELDADD) $(LIBODP) $(DPDK_PMDS)
+PRELDADD =
 
 INCFLAGS = \
-I$(top_builddir)/platform/@with_platform@/include \
diff --git a/test/validation/api/Makefile.inc b/test/validation/api/Makefile.inc
index 871a37796..8610b5687 100644
--- a/test/validation/api/Makefile.inc
+++ b/test/validation/api/Makefile.inc
@@ -1,2 +1,3 @@
 include $(top_srcdir)/test/Makefile.inc
 
+PRELDADD += $(LIBCUNIT_COMMON)
diff --git 

[lng-odp] [PATCH v11 5/13] linux-gen: don't pass DPKD_LIBS for dynamic linking with libodp-linux

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 platform/linux-generic/libodp-linux.pc.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/libodp-linux.pc.in 
b/platform/linux-generic/libodp-linux.pc.in
index 220dbc9c6..962a4f78f 100644
--- a/platform/linux-generic/libodp-linux.pc.in
+++ b/platform/linux-generic/libodp-linux.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: libodp-linux
 Description: The ODP packet processing engine
 Version: @PKGCONFIG_VERSION@
-Libs: -L${libdir} -lodp-linux @DPDK_LIBS@
+Libs: -L${libdir} -lodp-linux
 Libs.private: @OPENSSL_STATIC_LIBS@ @DPDK_PMDS@ @DPDK_LIBS@ @PCAP_LIBS@ 
@PTHREAD_LIBS@ @TIMER_LIBS@ -lpthread @ATOMIC_LIBS@
 Cflags: -I${includedir}



[lng-odp] [PATCH v11 6/13] example: add missing libraries to LDADD variables

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 example/ipfragreass/Makefile.am | 2 ++
 example/ipsec/Makefile.am   | 1 +
 example/ipsec_api/Makefile.am   | 3 +++
 3 files changed, 6 insertions(+)

diff --git a/example/ipfragreass/Makefile.am b/example/ipfragreass/Makefile.am
index fa7d5c8bd..b98e066f8 100644
--- a/example/ipfragreass/Makefile.am
+++ b/example/ipfragreass/Makefile.am
@@ -1,5 +1,7 @@
 include $(top_srcdir)/example/Makefile.inc
 
+LDADD += $(ATOMIC_LIBS)
+
 bin_PROGRAMS = odp_ipfragreass
 
 odp_ipfragreass_SOURCES = odp_ipfragreass.c \
diff --git a/example/ipsec/Makefile.am b/example/ipsec/Makefile.am
index 85905ffa7..eba9b8bda 100644
--- a/example/ipsec/Makefile.am
+++ b/example/ipsec/Makefile.am
@@ -1,6 +1,7 @@
 include $(top_srcdir)/example/Makefile.inc
 
 AM_CPPFLAGS = $(OPENSSL_CPPFLAGS)
+LDADD += $(OPENSSL_LIBS)
 
 bin_PROGRAMS = odp_ipsec
 
diff --git a/example/ipsec_api/Makefile.am b/example/ipsec_api/Makefile.am
index 847326fc0..14bc5dd66 100644
--- a/example/ipsec_api/Makefile.am
+++ b/example/ipsec_api/Makefile.am
@@ -1,5 +1,8 @@
 include $(top_srcdir)/example/Makefile.inc
 
+AM_CPPFLAGS = $(OPENSSL_CPPFLAGS)
+LDADD += $(OPENSSL_LIBS)
+
 bin_PROGRAMS = odp_ipsec
 
 dist_bin_SCRIPTS = \



[lng-odp] [PATCH v11 3/13] doc: add missing implementers-guide images to Makefile.am

2018-01-03 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Omitting those images in Makefile.am made them disappear from
distribution tarball resulting in an improperly-built documentation
files.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 3c1b82834c36bc66d397aedd2f80da45160eae2d
 **/
 doc/implementers-guide/Makefile.am | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/implementers-guide/Makefile.am 
b/doc/implementers-guide/Makefile.am
index 07ee141c8..c407339e2 100644
--- a/doc/implementers-guide/Makefile.am
+++ b/doc/implementers-guide/Makefile.am
@@ -2,10 +2,12 @@ include ../Makefile.inc
 
 SRC= implementers-guide.adoc
 TARGET = implementers-guide.html
+IMAGES = $(IMAGES_DIR)/abi_llvm.svg \
+$(IMAGES_DIR)/abi_traditional.svg
 
-EXTRA_DIST = $(SRC)
+EXTRA_DIST = $(SRC) $(IMAGES)
 
 doc_DATA = $(TARGET)
-$(TARGET): $(SRC)
+$(TARGET): $(SRC) $(IMAGES)
 
 CLEANFILES = $(doc_DATA)



[lng-odp] [Linaro/odp] 9eebbe: linux-gen: add memory-mapped I/O access API

2018-01-03 Thread GitHub
  Branch: refs/heads/caterpillar
  Home:   https://github.com/Linaro/odp
  Commit: 9eebbe7d21f0b933190fd910c54c872eecfe180e
  
https://github.com/Linaro/odp/commit/9eebbe7d21f0b933190fd910c54c872eecfe180e
  Author: Mykyta Iziumtsev 
  Date:   2018-01-04 (Thu, 04 Jan 2018)

  Changed paths:
A include/odp/drv/spec/mmio.h
A platform/linux-generic/include/odp/drv/mmio.h
M scripts/checkpatch.pl

  Log Message:
  ---
  linux-gen: add memory-mapped I/O access API

Signed-off-by: Mykyta Iziumtsev 
Reviewed-by: Bill Fischofer 
Signed-off-by: Yi He 


  Commit: 2d0ddc0917fa97d4ee9d1ec7009fe1abb9c42085
  
https://github.com/Linaro/odp/commit/2d0ddc0917fa97d4ee9d1ec7009fe1abb9c42085
  Author: Mykyta Iziumtsev 
  Date:   2018-01-04 (Thu, 04 Jan 2018)

  Changed paths:
M platform/linux-generic/pktio/ethtool.c
M platform/linux-generic/pktio/ethtool.h

  Log Message:
  ---
  linux-gen: extend ethtool helper functions

Add helper function to query RX/TX queue lengths on network interface to
facilitate upcoming native and mediated device drivers.

Signed-off-by: Mykyta Iziumtsev 
Reviewed-by: Bill Fischofer 
Signed-off-by: Yi He 


  Commit: a3f913fe4d0008641684b90d7209d23296a48767
  
https://github.com/Linaro/odp/commit/a3f913fe4d0008641684b90d7209d23296a48767
  Author: Mykyta Iziumtsev 
  Date:   2018-01-04 (Thu, 04 Jan 2018)

  Changed paths:
M platform/linux-generic/pktio/common.c
M platform/linux-generic/pktio/socket.c
M platform/linux-generic/pktio/socket_mmap.c
M platform/linux-generic/pktio/sysfs.c
M platform/linux-generic/pktio/sysfs.h

  Log Message:
  ---
  linux-gen: extend sysfs parsing helper functions

Added char* and uint64_t sysfs attribute read functions to support
upcoming native and mediated device drivers.

Updated sysfs_netif_stats() to take interface name as argument instead
of pktio_entry, because pktio_entry->s.name is not necessarily
recognisable Linux network interface name.

Signed-off-by: Mykyta Iziumtsev 
Reviewed-by: Bill Fischofer 
Signed-off-by: Yi He 


  Commit: 055516066c0a1104501cfd1050f0407fbec230c1
  
https://github.com/Linaro/odp/commit/055516066c0a1104501cfd1050f0407fbec230c1
  Author: Mykyta Iziumtsev 
  Date:   2018-01-04 (Thu, 04 Jan 2018)

  Changed paths:
M platform/linux-generic/include/odp_bitmap_internal.h
M platform/linux-generic/include/odp_internal.h
M platform/linux-generic/include/odp_traffic_mngr_internal.h
M platform/linux-generic/odp_name_table.c
M platform/linux-generic/odp_pkt_queue.c
M platform/linux-generic/odp_timer_wheel.c
M platform/linux-generic/odp_traffic_mngr.c
M platform/linux-generic/queue/scalable.c
M platform/linux-generic/schedule/scalable.c

  Log Message:
  ---
  linux-gen: move common macros to odp_internal.h

Gather macros needed for upcoming mediated devices in one location.
Fix signed vs. unsigned comparisons caused by incorrect MIN / MAX usage.

Signed-off-by: Mykyta Iziumtsev 
Reviewed-by: Bill Fischofer 
Signed-off-by: Yi He 


  Commit: 0b9b3c3ee67e11b798c41ac6ac8b71f80546f1d2
  
https://github.com/Linaro/odp/commit/0b9b3c3ee67e11b798c41ac6ac8b71f80546f1d2
  Author: Joyce Kong 
  Date:   2018-01-04 (Thu, 04 Jan 2018)

  Changed paths:
M platform/linux-dpdk/include/odp_buffer_internal.h
M platform/linux-dpdk/odp_packet.c
M platform/linux-dpdk/pool/dpdk.c

  Log Message:
  ---
  linux-dpdk: buffer: remove handle/index in metadata

Signed-off-by: Joyce Kong 
Reviewed-by: Bill Fischofer 
Signed-off-by: Yi He 


  Commit: 4d17f8ae64aba0e6f24877be30f86ae5880cef7e
  
https://github.com/Linaro/odp/commit/4d17f8ae64aba0e6f24877be30f86ae5880cef7e
  Author: Joyce Kong 
  Date:   2018-01-04 (Thu, 04 Jan 2018)

  Changed paths:
M platform/linux-generic/buffer/generic.c
M platform/linux-generic/include/odp_buffer_internal.h
M platform/linux-generic/include/odp_pool_internal.h
M platform/linux-generic/odp_packet.c
M platform/linux-generic/pool/generic.c

  Log Message:
  ---
  linux-generic: buffer: remove handle/index in metadata

Signed-off-by: Joyce Kong 
Reviewed-by: Bill Fischofer 
Signed-off-by: Yi He 


Compare: https://github.com/Linaro/odp/compare/bbbe6c0ef65c...4d17f8ae64ab


[lng-odp] [PATCH CATERPILLAR v4 4/4] linux-gen: packet: calculate the start of packet pointer

2018-01-03 Thread Github ODP bot
From: Brian Brooks 

The start of packet pointer was adjusted on every operation involving
headroom manipulation. This meant that this pointer had to be restored
to its pristine (aligned) offset when the buffer was recycled for reuse.

Instead of maintaining a pristine offset that could be used to restore
this pointer, use a (fixed) pointer to the start of the buffer i.e.
start of headroom. On operations involving headroom manipulation, only
modify the headroom offset value. This means that the start of packet
pointer must be calculated as start of buffer + headroom.

Signed-off-by: Brian Brooks 
Signed-off-by: Honnappa Nagarahalli 
---
/** Email created from pull request 354 (brbrooks:caterpillar)
 ** https://github.com/Linaro/odp/pull/354
 ** Patch: https://github.com/Linaro/odp/pull/354.patch
 ** Base sha: 4d17f8ae64aba0e6f24877be30f86ae5880cef7e
 ** Merge commit sha: 223d05c5b9ecf4986ec07a833a2630eafbbc3a4d
 **/
 platform/linux-generic/buffer/generic.c|  4 +-
 .../include/odp/api/plat/packet_inlines.h  | 15 +++---
 .../include/odp/api/plat/packet_types.h|  2 +-
 .../linux-generic/include/odp_buffer_internal.h| 11 ++--
 .../linux-generic/include/odp_packet_internal.h| 12 ++---
 platform/linux-generic/odp_packet.c| 59 ++
 platform/linux-generic/pktio/dpdk.c|  6 +--
 platform/linux-generic/pktio/ipc.c |  2 +-
 platform/linux-generic/pool/generic.c  | 13 ++---
 9 files changed, 58 insertions(+), 66 deletions(-)

diff --git a/platform/linux-generic/buffer/generic.c 
b/platform/linux-generic/buffer/generic.c
index 4406a10e9..7aaecc2ce 100644
--- a/platform/linux-generic/buffer/generic.c
+++ b/platform/linux-generic/buffer/generic.c
@@ -31,7 +31,7 @@ static void *generic_buffer_addr(odp_buffer_t buf)
 {
odp_buffer_hdr_t *hdr = buf_hdl_to_hdr(buf);
 
-   return hdr->base_data;
+   return hdr->buf_start;
 }
 
 static uint32_t generic_buffer_size(odp_buffer_t buf)
@@ -61,7 +61,7 @@ int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t 
buf)
"  pool %" PRIu64 "\n",
odp_pool_to_u64(pool->pool_hdl));
len += snprintf([len], n - len,
-   "  addr %p\n",  hdr->base_data);
+   "  addr %p\n",  hdr->buf_start);
len += snprintf([len], n - len,
"  size %" PRIu32 "\n", hdr->size);
len += snprintf([len], n - len,
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h 
b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
index 06bcf8557..af7c54ea7 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
@@ -35,12 +35,6 @@ static inline odp_packet_seg_t 
_odp_packet_seg_from_ndx(uint32_t ndx)
 }
 #endif
 
-/** @internal Inline function @param pkt @return */
-static inline void *_odp_packet_data(odp_packet_t pkt)
-{
-   return _odp_pkt_get(pkt, void *, data);
-}
-
 /** @internal Inline function @param pkt @return */
 static inline uint32_t _odp_packet_seg_len(odp_packet_t pkt)
 {
@@ -65,6 +59,13 @@ static inline uint32_t _odp_packet_tailroom(odp_packet_t pkt)
return _odp_pkt_get(pkt, uint16_t, tailroom);
 }
 
+/** @internal Inline function @param pkt @return */
+static inline void *_odp_packet_data(odp_packet_t pkt)
+{
+   return _odp_pkt_get(pkt, uint8_t *, buf_start) +
+   _odp_packet_headroom(pkt);
+}
+
 /** @internal Inline function @param pkt @return */
 static inline odp_pool_t _odp_packet_pool(odp_packet_t pkt)
 {
@@ -110,7 +111,7 @@ static inline odp_time_t _odp_packet_ts(odp_packet_t pkt)
 /** @internal Inline function @param pkt @return */
 static inline void *_odp_packet_head(odp_packet_t pkt)
 {
-   return (uint8_t *)_odp_packet_data(pkt) - _odp_packet_headroom(pkt);
+   return _odp_pkt_get(pkt, void *, buf_start);
 }
 
 /** @internal Inline function @param pkt @return */
diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h 
b/platform/linux-generic/include/odp/api/plat/packet_types.h
index 009a3aa7c..e3774cf0d 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_types.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_types.h
@@ -74,7 +74,7 @@ typedef enum {
 /** @internal Packet header field offsets for inline functions */
 typedef struct _odp_packet_inline_offset_t {
/** @internal field offset */
-   uint16_t data;
+   uint16_t buf_start;
/** @internal field offset */
uint16_t seg_len;
/** @internal field offset */
diff --git a/platform/linux-generic/include/odp_buffer_internal.h 
b/platform/linux-generic/include/odp_buffer_internal.h
index 2fd00c694..9fbbd28f6 100644
--- 

[lng-odp] [PATCH CATERPILLAR v4 1/4] linux-gen: packet: remove duplicated odp_packet_hdr() function

2018-01-03 Thread Github ODP bot
From: Brian Brooks 

odp_packet_hdr() and packet_hdr() are both internal-only functions that do
the same exact thing. Remove odp_packet_hdr() version since "odp_" prefix
is reserved for top-level API identifiers. This is also consistent with
other packet_xxx() internal-only functions.

Signed-off-by: Brian Brooks 
Reviewed-by: Yi He 
Reviewed-by: Ola Liljedahl 
Reviewed-by: Honnappa Nagarahalli 
Reviewed-by: Kevin Wang 
---
/** Email created from pull request 354 (brbrooks:caterpillar)
 ** https://github.com/Linaro/odp/pull/354
 ** Patch: https://github.com/Linaro/odp/pull/354.patch
 ** Base sha: 4d17f8ae64aba0e6f24877be30f86ae5880cef7e
 ** Merge commit sha: 223d05c5b9ecf4986ec07a833a2630eafbbc3a4d
 **/
 .../linux-generic/include/odp_packet_internal.h|  4 ++--
 platform/linux-generic/odp_crypto.c|  2 +-
 platform/linux-generic/odp_ipsec.c |  6 +++---
 platform/linux-generic/odp_packet.c|  5 -
 platform/linux-generic/odp_packet_flags.c  | 22 +++---
 platform/linux-generic/odp_packet_io.c |  4 ++--
 platform/linux-generic/pktio/dpdk.c| 12 ++--
 platform/linux-generic/pktio/ipc.c | 14 +++---
 platform/linux-generic/pktio/loopback.c|  2 +-
 platform/linux-generic/pktio/netmap.c  |  2 +-
 platform/linux-generic/pktio/pcap.c|  2 +-
 platform/linux-generic/pktio/socket.c  |  2 +-
 platform/linux-generic/pktio/socket_mmap.c |  2 +-
 platform/linux-generic/pktio/tap.c |  2 +-
 14 files changed, 38 insertions(+), 43 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index fed562aa3..3a86ce928 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -162,7 +162,7 @@ typedef struct {
 /**
  * Return the packet header
  */
-static inline odp_packet_hdr_t *odp_packet_hdr(odp_packet_t pkt)
+static inline odp_packet_hdr_t *packet_hdr(odp_packet_t pkt)
 {
return (odp_packet_hdr_t *)(uintptr_t)pkt;
 }
@@ -174,7 +174,7 @@ static inline odp_packet_t packet_handle(odp_packet_hdr_t 
*pkt_hdr)
 
 static inline odp_buffer_hdr_t *packet_to_buf_hdr(odp_packet_t pkt)
 {
-   return _packet_hdr(pkt)->buf_hdr;
+   return _hdr(pkt)->buf_hdr;
 }
 
 static inline odp_packet_t packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr)
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 3174feee0..2a85124ee 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -1127,7 +1127,7 @@ odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt)
 static
 odp_crypto_packet_result_t *get_op_result_from_packet(odp_packet_t pkt)
 {
-   odp_packet_hdr_t *hdr = odp_packet_hdr(pkt);
+   odp_packet_hdr_t *hdr = packet_hdr(pkt);
 
return >crypto_op_result;
 }
diff --git a/platform/linux-generic/odp_ipsec.c 
b/platform/linux-generic/odp_ipsec.c
index e57736c2a..23f86f69a 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -98,7 +98,7 @@ static odp_ipsec_packet_result_t 
*ipsec_pkt_result(odp_packet_t packet)
ODP_ASSERT(ODP_EVENT_PACKET_IPSEC ==
   odp_event_subtype(odp_packet_to_event(packet)));
 
-   return _packet_hdr(packet)->ipsec_ctx;
+   return _hdr(packet)->ipsec_ctx;
 }
 
 /**
@@ -541,7 +541,7 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
}
 
if (!status->error.all) {
-   odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
+   odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
packet_parse_reset(pkt_hdr);
 
@@ -1120,7 +1120,7 @@ int _odp_ipsec_try_inline(odp_packet_t pkt)
result->status = status;
result->sa = ipsec_sa->ipsec_sa_hdl;
 
-   pkt_hdr = odp_packet_hdr(pkt);
+   pkt_hdr = packet_hdr(pkt);
pkt_hdr->p.input_flags.dst_queue = 1;
pkt_hdr->dst_queue = queue_fn->from_ext(ipsec_sa->queue);
 
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index 853d3baa9..80ea0384e 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -45,11 +45,6 @@ const _odp_packet_inline_offset_t _odp_packet_inline 
ODP_ALIGNED_CACHE = {
 
 #include 
 
-static inline odp_packet_hdr_t *packet_hdr(odp_packet_t pkt)
-{
-   return (odp_packet_hdr_t *)(uintptr_t)pkt;
-}
-
 static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr)
 {
return (odp_buffer_t)pkt_hdr;
diff --git a/platform/linux-generic/odp_packet_flags.c 
b/platform/linux-generic/odp_packet_flags.c
index 2e26ad601..5beae933d 100644
--- 

[lng-odp] [PATCH CATERPILLAR v4 2/4] linux-gen: packet: remove duplicated _odp_packet_from_buf_hdr() function

2018-01-03 Thread Github ODP bot
From: Brian Brooks 

_odp_packet_from_buf_hdr() and packet_from_buf_hdr() are both
internal-only functions that do the exact same thing. Remove
_odp_packet_from_buf_hdr() version since internal-only identifiers
should not use any form of an "odp_" prefix. This is also
consistent with other packet_xxx() internal-only functions.

Signed-off-by: Brian Brooks 
Reviewed-by: Yi He 
Reviewed-by: Ola Liljedahl 
Reviewed-by: Honnappa Nagarahalli 
---
/** Email created from pull request 354 (brbrooks:caterpillar)
 ** https://github.com/Linaro/odp/pull/354
 ** Patch: https://github.com/Linaro/odp/pull/354.patch
 ** Base sha: 4d17f8ae64aba0e6f24877be30f86ae5880cef7e
 ** Merge commit sha: 223d05c5b9ecf4986ec07a833a2630eafbbc3a4d
 **/
 platform/linux-generic/include/odp_packet_internal.h | 3 ---
 platform/linux-generic/odp_packet.c  | 5 -
 platform/linux-generic/odp_traffic_mngr.c| 2 +-
 3 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index 3a86ce928..98d364a8d 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -290,9 +290,6 @@ int packet_parse_l3_l4(odp_packet_hdr_t *pkt_hdr,
 /* Reset parser metadata for a new parse */
 void packet_parse_reset(odp_packet_hdr_t *pkt_hdr);
 
-/* Convert a buffer handle to a packet handle */
-odp_packet_t _odp_packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr);
-
 static inline int packet_hdr_has_l2(odp_packet_hdr_t *pkt_hdr)
 {
return pkt_hdr->p.input_flags.l2;
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index 80ea0384e..e0fc01b29 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -55,11 +55,6 @@ static inline odp_packet_hdr_t 
*buf_to_packet_hdr(odp_buffer_t buf)
return (odp_packet_hdr_t *)buf_hdl_to_hdr(buf);
 }
 
-odp_packet_t _odp_packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr)
-{
-   return (odp_packet_t)buf_hdr;
-}
-
 static inline seg_entry_t *seg_entry(odp_packet_hdr_t *hdr,
 uint32_t seg_idx)
 {
diff --git a/platform/linux-generic/odp_traffic_mngr.c 
b/platform/linux-generic/odp_traffic_mngr.c
index ab06b3c0d..416b1d099 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -108,7 +108,7 @@ static int queue_tm_reenq(queue_t queue, odp_buffer_hdr_t 
*buf_hdr)
odp_tm_queue_t tm_queue = MAKE_ODP_TM_QUEUE((uint8_t *)queue -
offsetof(tm_queue_obj_t,
 tm_qentry));
-   odp_packet_t pkt = _odp_packet_from_buf_hdr(buf_hdr);
+   odp_packet_t pkt = packet_from_buf_hdr(buf_hdr);
 
return odp_tm_enq(tm_queue, pkt);
 }



[lng-odp] [PATCH CATERPILLAR v4 3/4] linux-gen: packet: remove excess segmentation metadata

2018-01-03 Thread Github ODP bot
From: Brian Brooks 

Use a single pointer to next segment instead of an array of
pointers. This reduces buffer metadata by ~140 bytes.

Signed-off-by: Brian Brooks 
Signed-off-by: Honnappa Nagarahalli 
---
/** Email created from pull request 354 (brbrooks:caterpillar)
 ** https://github.com/Linaro/odp/pull/354
 ** Patch: https://github.com/Linaro/odp/pull/354.patch
 ** Base sha: 4d17f8ae64aba0e6f24877be30f86ae5880cef7e
 ** Merge commit sha: 223d05c5b9ecf4986ec07a833a2630eafbbc3a4d
 **/
 platform/linux-generic/buffer/generic.c|4 +-
 .../linux-generic/include/odp_buffer_internal.h|   20 +-
 .../linux-generic/include/odp_packet_internal.h|   91 +-
 platform/linux-generic/odp_packet.c| 1452 ++--
 platform/linux-generic/pktio/dpdk.c|8 +-
 platform/linux-generic/pktio/ipc.c |2 +-
 platform/linux-generic/pool/generic.c  |   25 +-
 test/validation/api/packet/packet.c|2 +-
 8 files changed, 500 insertions(+), 1104 deletions(-)

diff --git a/platform/linux-generic/buffer/generic.c 
b/platform/linux-generic/buffer/generic.c
index cf99407cc..4406a10e9 100644
--- a/platform/linux-generic/buffer/generic.c
+++ b/platform/linux-generic/buffer/generic.c
@@ -31,7 +31,7 @@ static void *generic_buffer_addr(odp_buffer_t buf)
 {
odp_buffer_hdr_t *hdr = buf_hdl_to_hdr(buf);
 
-   return hdr->seg[0].data;
+   return hdr->base_data;
 }
 
 static uint32_t generic_buffer_size(odp_buffer_t buf)
@@ -61,7 +61,7 @@ int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t 
buf)
"  pool %" PRIu64 "\n",
odp_pool_to_u64(pool->pool_hdl));
len += snprintf([len], n - len,
-   "  addr %p\n",  hdr->seg[0].data);
+   "  addr %p\n",  hdr->base_data);
len += snprintf([len], n - len,
"  size %" PRIu32 "\n", hdr->size);
len += snprintf([len], n - len,
diff --git a/platform/linux-generic/include/odp_buffer_internal.h 
b/platform/linux-generic/include/odp_buffer_internal.h
index 514e24798..2fd00c694 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -35,12 +35,6 @@ extern "C" {
 
 #define BUFFER_BURST_SIZECONFIG_BURST_SIZE
 
-typedef struct seg_entry_t {
-   void *hdr;
-   uint8_t  *data;
-   uint32_t  len;
-} seg_entry_t;
-
 /* Common buffer header */
 struct odp_buffer_hdr_t {
 
@@ -53,26 +47,18 @@ struct odp_buffer_hdr_t {
/* Pool type */
int8_ttype;
 
-   /* Number of seg[] entries used */
-   uint8_t   num_seg;
+   /* Offset used to restore base_data */
+   uint8_t pristine_offset;
 
/* Next header which continues the segment list */
void *next_seg;
 
-   /* Last header of the segment list */
-   void *last_seg;
-
-   /* Initial buffer data pointer */
+   /* Pointer to start of segment */
uint8_t  *base_data;
 
/* Pool pointer */
void *pool_ptr;
 
-   /* --- 40 bytes --- */
-
-   /* Segments */
-   seg_entry_t seg[CONFIG_PACKET_SEGS_PER_HDR];
-
 #ifndef ODP_SCHEDULE_SCALABLE
/* Burst counts */
uint8_t   burst_num;
diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index 98d364a8d..8f381f097 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -20,6 +20,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -159,9 +160,6 @@ typedef struct {
uint8_t data[0];
 } odp_packet_hdr_t;
 
-/**
- * Return the packet header
- */
 static inline odp_packet_hdr_t *packet_hdr(odp_packet_t pkt)
 {
return (odp_packet_hdr_t *)(uintptr_t)pkt;
@@ -182,58 +180,76 @@ static inline odp_packet_t 
packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr)
return (odp_packet_t)(odp_packet_hdr_t *)buf_hdr;
 }
 
-static inline seg_entry_t *seg_entry_last(odp_packet_hdr_t *hdr)
+static inline odp_packet_hdr_t *packet_last_seg(odp_packet_hdr_t *pkt_hdr)
 {
-   odp_packet_hdr_t *last;
-   uint8_t last_seg;
+   int segcount = pkt_hdr->buf_hdr.segcount;
+
+   if (odp_unlikely(segcount > 1)) {
+   while (--segcount)
+   pkt_hdr = pkt_hdr->buf_hdr.next_seg;
+   }
 
-   last = hdr->buf_hdr.last_seg;
-   last_seg = last->buf_hdr.num_seg - 1;
-   return >buf_hdr.seg[last_seg];
+   ODP_ASSERT(pkt_hdr->buf_hdr.next_seg == NULL);
+
+   return pkt_hdr;
 }
 
-/**
- * Initialize packet
- */
 static inline void packet_init(odp_packet_hdr_t *pkt_hdr, uint32_t len)
 {
pool_t *pool = 

[lng-odp] RSS in ODP

2018-01-03 Thread Oriol Arcas
Hello and happy new year,

In our company we are looking into scaling the odp_schedule() calls.
Currently we are manually doing Receive Side Scaling, which requires one
CPU to receive all the packets and pass them to other worker CPU in a
flow-deterministic way (i.e., not spreading the packets from a TCP flow to
different CPUs). Obviously this is a bottleneck.

It would be great if ODP had optional RSS policies, which ultimately would
assign packets from the same flow to a single thread in the schedule group
(usually hashing the address tuple). Would this probably mean having
dedicated queues?

I don't know if there is something similar in ODP already which I have
missed. I'll thank any feedback!

Best regards,

--
Oriol Arcas
Software Engineer
Starflow Networks


Re: [lng-odp] [PATCH v9] Misc fixes

2018-01-03 Thread Github ODP bot
Petri Savolainen(psavol) replied on github web page:

test/validation/api/time/time.c
line 25
@@ -436,12 +436,12 @@ static void time_test_accuracy(time_cb time_cur, 
time_from_ns_cb time_from_ns)
wait = odp_time_sum(wait, sec);
}
 
+   c2 = time(NULL);
t2 = time_cur();
-   c2 = clock();
 
diff  = odp_time_diff(t2, t1);
sec_t = ((double)odp_time_to_ns(diff)) / ODP_TIME_SEC_IN_NS;
-   sec_c = ((double)(c2 - c1)) / CLOCKS_PER_SEC;
+   sec_c = ((double)(c2 - c1));


Comment:
time_t is an integer value of seconds, right? sec_c is the reference that we 
compare ODP time measurement against. Test passes if ODP measures within +-5% 
the reference. Usage of time() change the reference to be very coarse grained 
(e.g. 4, 5 or 6 sec), while the real time spent on the wait loop may be e.g. 
5.453 sec and ODP may measure 5.461 sec and the time() measures just 5.0 sec. 
So, test result would be "fail" (5.461 vs 5.0) although ODP measurement error 
was only+0.14% (5.461 vs 5.453).

> Dmitry Eremin-Solenikov(lumag) wrote:
> Well, no. Please recheck. I will update description to mention that is means 
> static linking of libodp-linux into examples.


>> muvarov wrote
>> At his time if --disable-static-link is specified then linking is static. If 
>> it's not specified that it's dynamic. I'm looking on odp_generator.


https://github.com/Linaro/odp/pull/377#discussion_r159401345
updated_at 2018-01-03 11:02:13


Re: [lng-odp] RSS in ODP

2018-01-03 Thread Bill Fischofer
ODP has several mechanisms for controlling workload distribution. The hash
functions can distribute packets from a given PktIO to a group of queues,
however the classifier is the most flexible means of controlling this. A
CoS defines a target queue for the flow. This is the queue that receives
input packets matching that flow. Queues have a defined
odp_schedule_param_t that controls their scheduling attributes, including
the odp_schedule_group_t that they belong to. Threads, in turn, can belong
to one or more schedule groups which determines which queue(s) they can
accept work from.

So you'd want to define a CoS/queue for each of the flows you're interested
in, assign them to their own scheduling groups and then have one or more
threads eligible to receive work from those queues. Note that a queue
belongs to only a single scheduling group while multiple queues can be in
the same group. Threads can also belong to multiple scheduling groups so
you have a lot of flexibility in how work is scheduled in a scalable manner.

Does that help?

On Wed, Jan 3, 2018 at 11:11 AM, Oriol Arcas 
wrote:

> Hello and happy new year,
>
> In our company we are looking into scaling the odp_schedule() calls.
> Currently we are manually doing Receive Side Scaling, which requires one
> CPU to receive all the packets and pass them to other worker CPU in a
> flow-deterministic way (i.e., not spreading the packets from a TCP flow to
> different CPUs). Obviously this is a bottleneck.
>
> It would be great if ODP had optional RSS policies, which ultimately would
> assign packets from the same flow to a single thread in the schedule group
> (usually hashing the address tuple). Would this probably mean having
> dedicated queues?
>
> I don't know if there is something similar in ODP already which I have
> missed. I'll thank any feedback!
>
> Best regards,
>
> --
> Oriol Arcas
> Software Engineer
> Starflow Networks
>