aboutsummaryrefslogtreecommitdiff
path: root/test/validation/api
diff options
context:
space:
mode:
Diffstat (limited to 'test/validation/api')
-rw-r--r--test/validation/api/crypto/odp_crypto_test_inp.c486
-rw-r--r--test/validation/api/ipsec/Makefile.am3
-rw-r--r--test/validation/api/ipsec/ipsec.c227
-rw-r--r--test/validation/api/ipsec/ipsec.h9
-rw-r--r--test/validation/api/ipsec/ipsec_async.c19
-rw-r--r--test/validation/api/ipsec/ipsec_inline_in.c14
-rw-r--r--test/validation/api/ipsec/ipsec_inline_out.c14
-rw-r--r--test/validation/api/ipsec/ipsec_sync.c10
-rw-r--r--test/validation/api/ipsec/ipsec_test_in.c35
-rw-r--r--test/validation/api/ipsec/reass_test_vectors.c353
-rw-r--r--test/validation/api/ipsec/reass_test_vectors.h362
-rw-r--r--test/validation/api/pool/pool.c58
12 files changed, 916 insertions, 674 deletions
diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c
index 7d6661be2..06ece9f50 100644
--- a/test/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/validation/api/crypto/odp_crypto_test_inp.c
@@ -1,4 +1,5 @@
/* Copyright (c) 2014-2018, Linaro Limited
+ * Copyright (c) 2021, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -174,7 +175,7 @@ static int alg_op(odp_packet_t pkt,
odp_packet_data_range_t *cipher_range,
odp_packet_data_range_t *auth_range,
uint8_t *aad,
- unsigned int plaintext_len)
+ unsigned int hash_result_offset)
{
int rc;
odp_crypto_op_result_t result;
@@ -198,7 +199,7 @@ static int alg_op(odp_packet_t pkt,
op_params.aad_ptr = aad;
- op_params.hash_result_offset = plaintext_len;
+ op_params.hash_result_offset = hash_result_offset;
rc = odp_crypto_operation(&op_params, &posted, &result);
if (rc < 0) {
@@ -254,7 +255,7 @@ static int alg_packet_op(odp_packet_t pkt,
odp_packet_data_range_t *cipher_range,
odp_packet_data_range_t *auth_range,
uint8_t *aad,
- unsigned int plaintext_len)
+ unsigned int hash_result_offset)
{
int rc;
odp_crypto_packet_result_t result;
@@ -275,7 +276,7 @@ static int alg_packet_op(odp_packet_t pkt,
op_params.aad_ptr = aad;
- op_params.hash_result_offset = plaintext_len;
+ op_params.hash_result_offset = hash_result_offset;
rc = odp_crypto_op(&pkt, &out_pkt, &op_params, 1);
if (rc <= 0) {
@@ -315,7 +316,7 @@ static int alg_packet_op_enq(odp_packet_t pkt,
odp_packet_data_range_t *cipher_range,
odp_packet_data_range_t *auth_range,
uint8_t *aad,
- unsigned int plaintext_len)
+ unsigned int hash_result_offset)
{
int rc;
odp_event_t event;
@@ -337,7 +338,7 @@ static int alg_packet_op_enq(odp_packet_t pkt,
op_params.aad_ptr = aad;
- op_params.hash_result_offset = plaintext_len;
+ op_params.hash_result_offset = hash_result_offset;
rc = odp_crypto_op_enq(&pkt, &pkt, &op_params, 1);
if (rc <= 0) {
@@ -381,6 +382,69 @@ static int alg_packet_op_enq(odp_packet_t pkt,
return 0;
}
+/*
+ * Try to adjust packet so that the first segment holds 'first_seg_len' bytes
+ * of packet data (+ tailroom if first_seg_len is longer than the packet).
+ *
+ * If 'first_seg_len' is zero, do not try to add segments but make headroom
+ * zero.
+ *
+ * Packet data bytes are not preserved.
+ */
+static void adjust_segments(odp_packet_t *pkt, uint32_t first_seg_len)
+{
+ uint32_t shift;
+
+ shift = odp_packet_headroom(*pkt) + first_seg_len;
+
+ if (odp_packet_extend_head(pkt, shift, NULL, NULL) < 0) {
+ CU_FAIL("odp_packet_extend_head() failed\n");
+ return;
+ }
+ if (odp_packet_trunc_tail(pkt, shift, NULL, NULL) < 0) {
+ CU_FAIL("odp_packet_trunc_tail() failed\n");
+ return;
+ }
+ /*
+ * ODP API does not seem to guarantee that we ever have a multi-segment
+ * packet at this point, but we can print a message about it.
+ */
+ if (first_seg_len == 1 &&
+ first_seg_len != odp_packet_seg_len(*pkt))
+ printf("Could not create a segmented packet for testing.\n");
+}
+
+/*
+ * Generate or verify header and trailer bytes
+ */
+static void do_header_and_trailer(odp_packet_t pkt,
+ uint32_t header_len, uint32_t trailer_len,
+ odp_bool_t check)
+{
+ uint32_t trailer_offset = odp_packet_len(pkt) - trailer_len;
+ uint32_t max_len = header_len > trailer_len ? header_len : trailer_len;
+ uint8_t buffer[max_len];
+ uint32_t n;
+ int rc;
+
+ for (n = 0; n < max_len; n++)
+ buffer[n] = n;
+
+ if (check) {
+ CU_ASSERT(!packet_cmp_mem_bytes(pkt, 0,
+ buffer, header_len));
+ CU_ASSERT(!packet_cmp_mem_bytes(pkt, trailer_offset,
+ buffer, trailer_len));
+ } else {
+ rc = odp_packet_copy_from_mem(pkt, 0,
+ header_len, buffer);
+ CU_ASSERT(rc == 0);
+ rc = odp_packet_copy_from_mem(pkt, trailer_offset,
+ trailer_len, buffer);
+ CU_ASSERT(rc == 0);
+ }
+}
+
typedef enum crypto_test {
NORMAL_TEST = 0, /**< Plain execution */
REPEAT_TEST, /**< Rerun without reinitializing the session */
@@ -388,6 +452,135 @@ typedef enum crypto_test {
MAX_TEST, /**< Final mark */
} crypto_test;
+typedef struct alg_test_param_t {
+ odp_crypto_session_t session;
+ odp_crypto_op_t op;
+ odp_auth_alg_t auth_alg;
+ crypto_test_reference_t *ref;
+ odp_bool_t override_iv;
+ odp_bool_t bit_mode;
+ odp_bool_t adjust_segmentation;
+ uint32_t first_seg_len;
+ uint32_t header_len;
+ uint32_t trailer_len;
+} alg_test_param_t;
+
+static void alg_test_execute(const alg_test_param_t *param)
+{
+ int rc;
+ odp_bool_t ok = false;
+ int iteration;
+ uint32_t reflength;
+ odp_packet_data_range_t cipher_range;
+ odp_packet_data_range_t auth_range;
+ crypto_test_reference_t *ref = param->ref;
+ uint8_t *cipher_iv = param->override_iv ? ref->cipher_iv : NULL;
+ uint8_t *auth_iv = param->override_iv ? ref->auth_iv : NULL;
+
+ cipher_range.offset = param->header_len;
+ cipher_range.length = ref->length;
+ auth_range.offset = param->header_len;
+ auth_range.length = ref->length;
+
+ if (param->bit_mode) {
+ reflength = (ref->length + 7) / 8;
+ cipher_range.offset *= 8;
+ auth_range.offset *= 8;
+ } else {
+ reflength = ref->length;
+ }
+
+ for (iteration = NORMAL_TEST; iteration < MAX_TEST; iteration++) {
+ odp_packet_t pkt;
+ uint32_t digest_offset = param->header_len + reflength;
+
+ /*
+ * Test detection of wrong digest value in input packet
+ * only when decoding and using non-null auth algorithm.
+ */
+ if (iteration == WRONG_DIGEST_TEST &&
+ (param->auth_alg == ODP_AUTH_ALG_NULL ||
+ param->op == ODP_CRYPTO_OP_ENCODE))
+ continue;
+
+ pkt = odp_packet_alloc(suite_context.pool,
+ param->header_len + reflength +
+ ref->digest_length + param->trailer_len);
+ CU_ASSERT(pkt != ODP_PACKET_INVALID);
+ if (pkt == ODP_PACKET_INVALID)
+ continue;
+
+ if (param->adjust_segmentation)
+ adjust_segments(&pkt, param->first_seg_len);
+
+ do_header_and_trailer(pkt, param->header_len, param->trailer_len, false);
+
+ if (param->op == ODP_CRYPTO_OP_ENCODE) {
+ odp_packet_copy_from_mem(pkt, param->header_len,
+ reflength, ref->plaintext);
+ } else {
+ odp_packet_copy_from_mem(pkt, param->header_len,
+ reflength, ref->ciphertext);
+ odp_packet_copy_from_mem(pkt, digest_offset,
+ ref->digest_length,
+ ref->digest);
+ if (iteration == WRONG_DIGEST_TEST) {
+ uint8_t byte = ~ref->digest[0];
+
+ odp_packet_copy_from_mem(pkt, digest_offset,
+ 1, &byte);
+ }
+ }
+
+ if (!suite_context.packet)
+ rc = alg_op(pkt, &ok, param->session,
+ cipher_iv, auth_iv,
+ &cipher_range, &auth_range,
+ ref->aad, digest_offset);
+ else if (ODP_CRYPTO_ASYNC == suite_context.op_mode)
+ rc = alg_packet_op_enq(pkt, &ok, param->session,
+ cipher_iv, auth_iv,
+ &cipher_range, &auth_range,
+ ref->aad, digest_offset);
+ else
+ rc = alg_packet_op(pkt, &ok, param->session,
+ cipher_iv, auth_iv,
+ &cipher_range, &auth_range,
+ ref->aad, digest_offset);
+ if (rc < 0) {
+ odp_packet_free(pkt);
+ break;
+ }
+
+ if (iteration == WRONG_DIGEST_TEST) {
+ CU_ASSERT(!ok);
+ odp_packet_free(pkt);
+ continue;
+ }
+
+ CU_ASSERT(ok);
+
+ do_header_and_trailer(pkt, param->header_len, param->trailer_len, true);
+
+ if (param->op == ODP_CRYPTO_OP_ENCODE) {
+ CU_ASSERT(!packet_cmp_mem(pkt, param->header_len,
+ ref->ciphertext,
+ ref->length,
+ param->bit_mode));
+ CU_ASSERT(!packet_cmp_mem(pkt, digest_offset,
+ ref->digest,
+ ref->digest_length,
+ param->bit_mode));
+ } else {
+ CU_ASSERT(!packet_cmp_mem(pkt, param->header_len,
+ ref->plaintext,
+ ref->length,
+ param->bit_mode));
+ }
+ odp_packet_free(pkt);
+ }
+}
+
/* Basic algorithm run function for async inplace mode.
* Creates a session from input parameters and runs one operation
* on input_vec. Checks the output of the crypto operation against
@@ -404,15 +597,14 @@ static void alg_test(odp_crypto_op_t op,
odp_bool_t ovr_iv,
odp_bool_t bit_mode)
{
+ unsigned int initial_num_failures = CU_get_number_of_failures();
odp_crypto_session_t session;
int rc;
- odp_crypto_ses_create_err_t status;
- odp_bool_t ok = false;
- int iteration;
uint32_t reflength;
+ uint32_t seg_len;
+ uint32_t max_shift;
+ odp_crypto_ses_create_err_t status;
odp_crypto_session_param_t ses_params;
- odp_packet_data_range_t cipher_range;
- odp_packet_data_range_t auth_range;
odp_crypto_key_t cipher_key = {
.data = ref->cipher_key,
.length = ref->cipher_key_length
@@ -429,6 +621,7 @@ static void alg_test(odp_crypto_op_t op,
.data = ovr_iv ? NULL : ref->auth_iv,
.length = ref->auth_iv_length
};
+ alg_test_param_t test_param;
/* Create a crypto session */
odp_crypto_session_param_init(&ses_params);
@@ -453,96 +646,47 @@ static void alg_test(odp_crypto_op_t op,
CU_ASSERT(odp_crypto_session_to_u64(session) !=
odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID));
- cipher_range.offset = 0;
- cipher_range.length = ref->length;
- auth_range.offset = 0;
- auth_range.length = ref->length;
+ memset(&test_param, 0, sizeof(test_param));
+ test_param.session = session;
+ test_param.op = op;
+ test_param.auth_alg = auth_alg;
+ test_param.ref = ref;
+ test_param.override_iv = ovr_iv;
+ test_param.bit_mode = bit_mode;
+
+ alg_test_execute(&test_param);
if (bit_mode)
reflength = (ref->length + 7) / 8;
else
reflength = ref->length;
-
- /* Prepare input data */
- odp_packet_t pkt = odp_packet_alloc(suite_context.pool,
- reflength + ref->digest_length);
- CU_ASSERT(pkt != ODP_PACKET_INVALID);
- if (pkt == ODP_PACKET_INVALID)
- goto cleanup;
-
- for (iteration = NORMAL_TEST; iteration < MAX_TEST; iteration++) {
- /* checking against wrong digest is meaningless for NULL digest
- * or when generating digest */
- if (iteration == WRONG_DIGEST_TEST &&
- (auth_alg == ODP_AUTH_ALG_NULL ||
- op == ODP_CRYPTO_OP_ENCODE))
- continue;
-
- if (op == ODP_CRYPTO_OP_ENCODE) {
- odp_packet_copy_from_mem(pkt, 0, reflength,
- ref->plaintext);
- } else {
- odp_packet_copy_from_mem(pkt, 0, reflength,
- ref->ciphertext);
- odp_packet_copy_from_mem(pkt, reflength,
- ref->digest_length,
- ref->digest);
- if (iteration == WRONG_DIGEST_TEST) {
- uint8_t byte = ~ref->digest[0];
-
- odp_packet_copy_from_mem(pkt, reflength,
- 1, &byte);
- }
- }
-
- if (!suite_context.packet)
- rc = alg_op(pkt, &ok, session,
- ovr_iv ? ref->cipher_iv : NULL,
- ovr_iv ? ref->auth_iv : NULL,
- &cipher_range, &auth_range,
- ref->aad, reflength);
- else if (ODP_CRYPTO_ASYNC == suite_context.op_mode)
- rc = alg_packet_op_enq(pkt, &ok, session,
- ovr_iv ? ref->cipher_iv : NULL,
- ovr_iv ? ref->auth_iv : NULL,
- &cipher_range, &auth_range,
- ref->aad, reflength);
- else
- rc = alg_packet_op(pkt, &ok, session,
- ovr_iv ? ref->cipher_iv : NULL,
- ovr_iv ? ref->auth_iv : NULL,
- &cipher_range, &auth_range,
- ref->aad, reflength);
- if (rc < 0)
+ max_shift = reflength + ref->digest_length;
+
+ /*
+ * Test with segmented packets with all possible segment boundaries
+ * within the packet data (including boundary after the packet data
+ * in the location where the digest will be written).
+ */
+ for (seg_len = 0; seg_len <= max_shift; seg_len++) {
+ /*
+ * CUnit chokes on too many assertion failures, so bail
+ * out if this test has already failed.
+ */
+ if (CU_get_number_of_failures() > initial_num_failures)
break;
- if (iteration == WRONG_DIGEST_TEST) {
- CU_ASSERT(!ok);
- continue;
- }
-
- CU_ASSERT(ok);
+ test_param.adjust_segmentation = true;
+ test_param.first_seg_len = seg_len;
+ test_param.header_len = 0;
+ test_param.trailer_len = 0;
+ alg_test_execute(&test_param);
- if (op == ODP_CRYPTO_OP_ENCODE) {
- CU_ASSERT(!packet_cmp_mem(pkt, 0,
- ref->ciphertext,
- ref->length,
- bit_mode));
- CU_ASSERT(!packet_cmp_mem(pkt, reflength,
- ref->digest,
- ref->digest_length,
- bit_mode));
- } else {
- CU_ASSERT(!packet_cmp_mem(pkt, 0,
- ref->plaintext,
- ref->length,
- bit_mode));
- }
+ /* Test partial packet crypto with odd alignment. */
+ test_param.header_len = 3;
+ test_param.trailer_len = 32;
+ alg_test_execute(&test_param);
}
- odp_packet_free(pkt);
-
-cleanup:
rc = odp_crypto_session_destroy(session);
CU_ASSERT(!rc);
}
@@ -1035,10 +1179,6 @@ static int check_alg_3des_cbc(void)
return check_alg_support(ODP_CIPHER_ALG_3DES_CBC, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * 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.*/
static void crypto_test_enc_alg_3des_cbc(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1050,9 +1190,6 @@ static void crypto_test_enc_alg_3des_cbc(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for 3DES_CBC algorithm. IV for the operation is the operation IV.
- * */
static void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1064,11 +1201,6 @@ static void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * 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.
- * */
static void crypto_test_dec_alg_3des_cbc(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1080,11 +1212,6 @@ static void crypto_test_dec_alg_3des_cbc(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * 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.
- * */
static void crypto_test_dec_alg_3des_cbc_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1101,8 +1228,6 @@ static int check_alg_3des_ecb(void)
return check_alg_support(ODP_CIPHER_ALG_3DES_ECB, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for 3DES_ECB algorithm. */
static void crypto_test_enc_alg_3des_ecb(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1114,11 +1239,6 @@ static void crypto_test_enc_alg_3des_ecb(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for 3DES_ECB 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.
- * */
static void crypto_test_dec_alg_3des_ecb(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1185,10 +1305,6 @@ static int check_alg_aes_gcm(void)
return check_alg_support(ODP_CIPHER_ALG_AES_GCM, ODP_AUTH_ALG_AES_GCM);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_GCM 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.*/
static void crypto_test_enc_alg_aes_gcm(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1200,10 +1316,6 @@ static void crypto_test_enc_alg_aes_gcm(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_GCM 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.*/
static void crypto_test_enc_alg_aes_gcm_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1215,11 +1327,6 @@ static void crypto_test_enc_alg_aes_gcm_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * 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.
- * */
static void crypto_test_dec_alg_aes_gcm(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1231,11 +1338,6 @@ static void crypto_test_dec_alg_aes_gcm(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * 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.
- * */
static void crypto_test_dec_alg_aes_gcm_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1301,10 +1403,6 @@ static int check_alg_aes_cbc(void)
return check_alg_support(ODP_CIPHER_ALG_AES_CBC, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_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.*/
static void crypto_test_enc_alg_aes_cbc(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1316,9 +1414,6 @@ static void crypto_test_enc_alg_aes_cbc(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_CBC algorithm. IV for the operation is the operation IV.
- * */
static void crypto_test_enc_alg_aes_cbc_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1330,11 +1425,6 @@ static void crypto_test_enc_alg_aes_cbc_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_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.
- * */
static void crypto_test_dec_alg_aes_cbc(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1346,11 +1436,6 @@ static void crypto_test_dec_alg_aes_cbc(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_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.
- * */
static void crypto_test_dec_alg_aes_cbc_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1367,10 +1452,6 @@ static int check_alg_aes_ctr(void)
return check_alg_support(ODP_CIPHER_ALG_AES_CTR, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_CTR 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.*/
static void crypto_test_enc_alg_aes_ctr(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1382,9 +1463,6 @@ static void crypto_test_enc_alg_aes_ctr(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_CTR algorithm. IV for the operation is the operation IV.
- * */
static void crypto_test_enc_alg_aes_ctr_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1396,11 +1474,6 @@ static void crypto_test_enc_alg_aes_ctr_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_CTR 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.
- * */
static void crypto_test_dec_alg_aes_ctr(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1412,11 +1485,6 @@ static void crypto_test_dec_alg_aes_ctr(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_CTR 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.
- * */
static void crypto_test_dec_alg_aes_ctr_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1433,9 +1501,6 @@ static int check_alg_aes_ecb(void)
return check_alg_support(ODP_CIPHER_ALG_AES_ECB, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_ECB algorithm.
- */
static void crypto_test_enc_alg_aes_ecb(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1447,9 +1512,6 @@ static void crypto_test_enc_alg_aes_ecb(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_ECB algorithm.
- * */
static void crypto_test_dec_alg_aes_ecb(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1466,11 +1528,6 @@ static int check_alg_aes_cfb128(void)
return check_alg_support(ODP_CIPHER_ALG_AES_CFB128, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_CFB128 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.*/
static void crypto_test_enc_alg_aes_cfb128(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1482,10 +1539,6 @@ static void crypto_test_enc_alg_aes_cfb128(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_CFB128 algorithm. IV for the operation is the operation
- * IV.
- * */
static void crypto_test_enc_alg_aes_cfb128_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1497,11 +1550,6 @@ static void crypto_test_enc_alg_aes_cfb128_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_CFB128 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.
- * */
static void crypto_test_dec_alg_aes_cfb128(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1513,11 +1561,6 @@ static void crypto_test_dec_alg_aes_cfb128(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_CFB128 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.
- * */
static void crypto_test_dec_alg_aes_cfb128_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1534,10 +1577,6 @@ static int check_alg_aes_xts(void)
return check_alg_support(ODP_CIPHER_ALG_AES_XTS, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_XTS 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.*/
static void crypto_test_enc_alg_aes_xts(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1549,9 +1588,6 @@ static void crypto_test_enc_alg_aes_xts(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_XTS algorithm. IV for the operation is the operation IV.
- * */
static void crypto_test_enc_alg_aes_xts_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1563,11 +1599,6 @@ static void crypto_test_enc_alg_aes_xts_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_XTS 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.
- * */
static void crypto_test_dec_alg_aes_xts(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1579,11 +1610,6 @@ static void crypto_test_dec_alg_aes_xts(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_XTS 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.
- * */
static void crypto_test_dec_alg_aes_xts_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1797,13 +1823,6 @@ static int check_alg_hmac_md5(void)
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_MD5_HMAC);
}
-/* This test verifies the correctness of HMAC_MD5 digest operation.
- * The output check length is truncated to 12 bytes (96 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_hmac_md5(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1831,13 +1850,6 @@ static int check_alg_hmac_sha1(void)
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA1_HMAC);
}
-/* This test verifies the correctness of HMAC_SHA1 digest operation.
- * The output check length is truncated to 12 bytes (96 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_hmac_sha1(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1892,13 +1904,6 @@ static int check_alg_hmac_sha256(void)
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA256_HMAC);
}
-/* This test verifies the correctness of HMAC_SHA256 digest operation.
- * The output check length is truncated to 16 bytes (128 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_hmac_sha256(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1926,13 +1931,6 @@ static int check_alg_hmac_sha384(void)
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA384_HMAC);
}
-/* This test verifies the correctness of HMAC_SHA384 digest operation.
- * The output check length is truncated to 24 bytes (192 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_hmac_sha384(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1960,13 +1958,6 @@ static int check_alg_hmac_sha512(void)
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA512_HMAC);
}
-/* This test verifies the correctness of HMAC_SHA512 digest operation.
- * The output check length is truncated to 32 bytes (256 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_hmac_sha512(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1995,13 +1986,6 @@ static int check_alg_aes_xcbc(void)
ODP_AUTH_ALG_AES_XCBC_MAC);
}
-/* This test verifies the correctness of AES_XCBC_MAC digest operation.
- * The output check length is truncated to 16 bytes (128 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_aes_xcbc(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
diff --git a/test/validation/api/ipsec/Makefile.am b/test/validation/api/ipsec/Makefile.am
index 8417a5776..1a29d687d 100644
--- a/test/validation/api/ipsec/Makefile.am
+++ b/test/validation/api/ipsec/Makefile.am
@@ -7,7 +7,8 @@ libtestipsec_la_SOURCES = \
ipsec_test_in.c \
ipsec_test_out.c \
ipsec.h \
- ipsec.c
+ ipsec.c \
+ reass_test_vectors.c
test_PROGRAMS = \
ipsec_sync \
diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c
index 5bbc9c025..c6fbe6f91 100644
--- a/test/validation/api/ipsec/ipsec.c
+++ b/test/validation/api/ipsec/ipsec.c
@@ -20,6 +20,7 @@ struct suite_context_s suite_context;
static odp_ipsec_capability_t capa;
#define PKT_POOL_NUM 64
+#define EVENT_WAIT_TIME ODP_TIME_SEC_IN_NS
#define PACKET_USER_PTR ((void *)0x1212fefe)
#define IPSEC_SA_CTX ((void *)0xfefefafa)
@@ -100,6 +101,41 @@ static int pktio_start(odp_pktio_t pktio, odp_bool_t in, odp_bool_t out)
return 1;
}
+static odp_event_t sched_queue_deq(uint64_t wait_ns)
+{
+ uint64_t wait = odp_schedule_wait_time(wait_ns);
+
+ return odp_schedule(NULL, wait);
+}
+
+static odp_event_t plain_queue_deq(odp_queue_t queue, uint64_t wait_ns)
+{
+ odp_time_t cur, wait, next;
+ odp_event_t event;
+
+ wait = odp_time_local_from_ns(wait_ns);
+ next = odp_time_sum(odp_time_local(), wait);
+
+ do {
+ event = odp_queue_deq(queue);
+ cur = odp_time_local();
+ } while (event == ODP_EVENT_INVALID && odp_time_cmp(next, cur) >= 0);
+
+ return event;
+}
+
+static odp_event_t recv_event(odp_queue_t queue, uint64_t wait_ns)
+{
+ odp_event_t event;
+
+ if (odp_queue_type(queue) == ODP_QUEUE_TYPE_PLAIN)
+ event = plain_queue_deq(queue, wait_ns);
+ else
+ event = sched_queue_deq(wait_ns);
+
+ return event;
+}
+
static void pktio_stop(odp_pktio_t pktio)
{
odp_queue_t queue = ODP_QUEUE_INVALID;
@@ -110,7 +146,7 @@ static void pktio_stop(odp_pktio_t pktio)
fprintf(stderr, "IPsec pktio stop failed.\n");
while (1) {
- odp_event_t ev = odp_queue_deq(queue);
+ odp_event_t ev = recv_event(queue, 0);
if (ev != ODP_EVENT_INVALID)
odp_event_free(ev);
@@ -139,6 +175,17 @@ int ipsec_check(odp_bool_t ah,
ODP_SUPPORT_NO == capa.op_mode_inline_out))
return ODP_TEST_INACTIVE;
+ if (!(ODP_IPSEC_OP_MODE_SYNC == suite_context.inbound_op_mode &&
+ ODP_IPSEC_OP_MODE_SYNC == suite_context.outbound_op_mode) &&
+ ODP_QUEUE_INVALID != suite_context.queue) {
+ if (suite_context.q_type == ODP_QUEUE_TYPE_PLAIN &&
+ !capa.queue_type_plain)
+ return ODP_TEST_INACTIVE;
+ if (suite_context.q_type == ODP_QUEUE_TYPE_SCHED &&
+ !capa.queue_type_sched)
+ return ODP_TEST_INACTIVE;
+ }
+
/* suite_context.pktio is set to ODP_PKTIO_INVALID in ipsec_suite_init()
* if the pktio device doesn't support inline IPsec processing. */
if (suite_context.pktio == ODP_PKTIO_INVALID &&
@@ -356,9 +403,7 @@ void ipsec_sa_destroy(odp_ipsec_sa_t sa)
CU_ASSERT_EQUAL(ODP_IPSEC_OK, odp_ipsec_sa_disable(sa));
if (ODP_QUEUE_INVALID != suite_context.queue) {
- do {
- event = odp_queue_deq(suite_context.queue);
- } while (event == ODP_EVENT_INVALID);
+ event = recv_event(suite_context.queue, EVENT_WAIT_TIME);
CU_ASSERT(odp_event_is_valid(event) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_IPSEC_STATUS, odp_event_type(event));
@@ -516,12 +561,27 @@ static int send_pkts(const ipsec_test_part part[], int num_part)
return num_part;
}
+/* Receive async inbound packet */
+static odp_event_t recv_pkt_async_inbound(odp_ipsec_op_status_t status)
+{
+ odp_queue_t queue;
+
+ /*
+ * In case of SA lookup failure, the event is enqueued to the default
+ * queue specified during odp_ipsec_config()
+ */
+ if (status.error.sa_lookup == 0)
+ queue = suite_context.queue;
+ else
+ queue = suite_context.default_queue;
+
+ return recv_event(queue, EVENT_WAIT_TIME);
+}
+
/* Receive inline processed packets */
static int recv_pkts_inline(const ipsec_test_part *part,
odp_packet_t *pkto)
{
- odp_packet_reass_partial_state_t reass_state;
- odp_packet_reass_status_t reass_status;
odp_queue_t queue = ODP_QUEUE_INVALID;
int i;
@@ -532,7 +592,7 @@ static int recv_pkts_inline(const ipsec_test_part *part,
odp_event_t ev;
odp_event_subtype_t subtype;
- ev = odp_queue_deq(queue);
+ ev = recv_event(queue, 0);
if (ODP_EVENT_INVALID != ev) {
CU_ASSERT(odp_event_is_valid(ev) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
@@ -547,10 +607,15 @@ static int recv_pkts_inline(const ipsec_test_part *part,
continue;
}
- ev = odp_queue_deq(suite_context.queue);
+ ev = recv_event(suite_context.queue, 0);
if (ODP_EVENT_INVALID != ev) {
odp_packet_t pkt;
int num_pkts = 0;
+ odp_packet_reass_status_t reass_status;
+ odp_packet_reass_info_t reass = {0};
+ odp_packet_reass_partial_state_t reass_state;
+ odp_packet_t frags[MAX_FRAGS];
+ int j;
CU_ASSERT(odp_event_is_valid(ev) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET, odp_event_type(ev));
@@ -559,13 +624,18 @@ static int recv_pkts_inline(const ipsec_test_part *part,
CU_ASSERT(!part->out[i].status.error.sa_lookup);
reass_status = odp_packet_reass_status(pkt);
- if (ODP_PACKET_REASS_INCOMPLETE != reass_status) {
+ CU_ASSERT(reass_status == part->out[i].reass_status);
+
+ switch (reass_status) {
+ case ODP_PACKET_REASS_COMPLETE:
+ CU_ASSERT(odp_packet_reass_info(pkt, &reass) == 0);
+ CU_ASSERT(part->out[i].num_frags == reass.num_frags);
+ /* FALLTHROUGH */
+ case ODP_PACKET_REASS_NONE:
pkto[i] = pkt;
num_pkts = 1;
- } else {
- odp_packet_t frags[MAX_FRAGS];
- int j;
-
+ break;
+ case ODP_PACKET_REASS_INCOMPLETE:
CU_ASSERT(0 ==
odp_packet_reass_partial_state(pkt, frags, &reass_state));
num_pkts = reass_state.num_frags;
@@ -573,6 +643,10 @@ static int recv_pkts_inline(const ipsec_test_part *part,
CU_ASSERT_FATAL(i + num_pkts <= part->num_pkt);
for (j = 0; j < num_pkts; j++)
pkto[i + j] = frags[j];
+ break;
+ default:
+ CU_FAIL("Unknown reassembly status");
+ break;
}
for (; num_pkts > 0; num_pkts--)
@@ -625,9 +699,7 @@ static int ipsec_process_in(const ipsec_test_part *part,
odp_event_t event;
odp_event_subtype_t subtype;
- do {
- event = odp_queue_deq(suite_context.queue);
- } while (event == ODP_EVENT_INVALID);
+ event = recv_pkt_async_inbound(part->out[i].status);
CU_ASSERT(odp_event_is_valid(event) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
@@ -680,9 +752,7 @@ static int ipsec_send_out_one(const ipsec_test_part *part,
odp_event_t event;
odp_event_subtype_t subtype;
- do {
- event = odp_queue_deq(suite_context.queue);
- } while (event == ODP_EVENT_INVALID);
+ event = recv_event(suite_context.queue, EVENT_WAIT_TIME);
CU_ASSERT(odp_event_is_valid(event) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
@@ -764,7 +834,7 @@ static int ipsec_send_out_one(const ipsec_test_part *part,
odp_event_t ev;
odp_event_subtype_t subtype;
- ev = odp_queue_deq(queue);
+ ev = recv_event(queue, 0);
if (ODP_EVENT_INVALID != ev) {
CU_ASSERT(odp_event_is_valid(ev) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
@@ -779,7 +849,7 @@ static int ipsec_send_out_one(const ipsec_test_part *part,
continue;
}
- ev = odp_queue_deq(suite_context.queue);
+ ev = recv_event(suite_context.queue, 0);
if (ODP_EVENT_INVALID != ev) {
CU_ASSERT(odp_event_is_valid(ev) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
@@ -878,6 +948,11 @@ static void verify_in(const ipsec_test_part *part,
if (ODP_IPSEC_SA_INVALID != sa)
CU_ASSERT_EQUAL(IPSEC_SA_CTX,
odp_ipsec_sa_context(sa));
+ if (suite_context.inbound_op_mode != ODP_IPSEC_OP_MODE_SYNC) {
+ uint32_t len = part->pkt_in->len - part->pkt_in->l3_offset;
+
+ CU_ASSERT(result.orig_ip_len == len);
+ }
}
ipsec_check_packet(part->out[i].pkt_res,
pkto[i],
@@ -1005,7 +1080,7 @@ void ipsec_check_out_one(const ipsec_test_part *part, odp_ipsec_sa_t sa)
odp_packet_free(pkto[i]);
}
-int ipsec_suite_init(void)
+static int ipsec_suite_init(void)
{
int rc = 0;
@@ -1033,11 +1108,16 @@ void ipsec_test_packet_from_pkt(ipsec_test_packet *test_pkt, odp_packet_t *pkt)
odp_packet_free(*pkt);
}
-static int ipsec_suite_term(void)
+int ipsec_suite_term(void)
{
if (suite_context.pktio != ODP_PKTIO_INVALID)
pktio_stop(suite_context.pktio);
+ if (ODP_QUEUE_INVALID != suite_context.queue) {
+ if (odp_queue_destroy(suite_context.queue))
+ fprintf(stderr, "IPsec destq destroy failed.\n");
+ }
+
if (odp_cunit_print_inactive())
return -1;
@@ -1054,19 +1134,80 @@ int ipsec_out_term(void)
return ipsec_suite_term();
}
+static odp_queue_t sched_queue_create(const char *name)
+{
+ odp_queue_param_t qparam;
+
+ odp_queue_param_init(&qparam);
+ qparam.type = ODP_QUEUE_TYPE_SCHED;
+ qparam.sched.prio = ODP_SCHED_PRIO_DEFAULT;
+ qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL;
+ qparam.sched.group = ODP_SCHED_GROUP_ALL;
+
+ return odp_queue_create(name, &qparam);
+}
+
+static odp_queue_t plain_queue_create(const char *name)
+{
+ return odp_queue_create(name, NULL);
+}
+
+int ipsec_suite_sync_init(void)
+{
+ suite_context.queue = ODP_QUEUE_INVALID;
+
+ /* q_type doesn't matter when queue handle is invalid. */
+ suite_context.q_type = ODP_QUEUE_TYPE_PLAIN;
+
+ return ipsec_suite_init();
+}
+
+int ipsec_suite_plain_init(void)
+{
+ odp_queue_t dest_queue;
+
+ dest_queue = plain_queue_create("ipsec-out");
+ if (ODP_QUEUE_INVALID == dest_queue) {
+ fprintf(stderr, "IPsec destq creation failed.\n");
+ return -1;
+ }
+
+ suite_context.queue = dest_queue;
+ suite_context.q_type = ODP_QUEUE_TYPE_PLAIN;
+
+ return ipsec_suite_init();
+}
+
+int ipsec_suite_sched_init(void)
+{
+ odp_queue_t dest_queue;
+
+ dest_queue = sched_queue_create("ipsec-out");
+ if (ODP_QUEUE_INVALID == dest_queue) {
+ fprintf(stderr, "IPsec destq creation failed.\n");
+ return -1;
+ }
+
+ suite_context.queue = dest_queue;
+ suite_context.q_type = ODP_QUEUE_TYPE_SCHED;
+
+ return ipsec_suite_init();
+}
+
int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode)
{
odp_pool_param_t params;
odp_pool_t pool;
- odp_queue_t out_queue;
odp_pool_capability_t pool_capa;
odp_pktio_t pktio;
odp_init_t init_param;
odph_helper_options_t helper_options;
+ suite_context.reass_ipv4 = false;
+ suite_context.reass_ipv6 = false;
suite_context.pool = ODP_POOL_INVALID;
- suite_context.queue = ODP_QUEUE_INVALID;
suite_context.pktio = ODP_PKTIO_INVALID;
+ suite_context.default_queue = ODP_QUEUE_INVALID;
if (odph_options(&helper_options)) {
fprintf(stderr, "error: odph_options() failed.\n");
@@ -1086,6 +1227,11 @@ int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode)
return -1;
}
+ if (odp_schedule_config(NULL)) {
+ fprintf(stderr, "odp_schedule_config() failed.\n");
+ return -1;
+ }
+
if (odp_pool_capability(&pool_capa) < 0) {
fprintf(stderr, "error: odp_pool_capability() failed.\n");
return -1;
@@ -1115,14 +1261,6 @@ int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode)
fprintf(stderr, "Packet pool creation failed.\n");
return -1;
}
- if (mode == ODP_IPSEC_OP_MODE_ASYNC ||
- mode == ODP_IPSEC_OP_MODE_INLINE) {
- out_queue = odp_queue_create("ipsec-out", NULL);
- if (ODP_QUEUE_INVALID == out_queue) {
- fprintf(stderr, "IPsec outq creation failed.\n");
- return -1;
- }
- }
if (mode == ODP_IPSEC_OP_MODE_INLINE) {
pktio = pktio_create(pool);
@@ -1159,6 +1297,19 @@ int ipsec_config(odp_instance_t ODP_UNUSED inst)
ODP_SUPPORT_NO == capa.op_mode_inline_out))
return 0;
+ if (suite_context.inbound_op_mode == ODP_IPSEC_OP_MODE_ASYNC ||
+ suite_context.inbound_op_mode == ODP_IPSEC_OP_MODE_INLINE) {
+ if (capa.queue_type_plain)
+ suite_context.default_queue = plain_queue_create("ipsec-default");
+ else if (capa.queue_type_sched)
+ suite_context.default_queue = sched_queue_create("ipsec-default");
+
+ if (ODP_QUEUE_INVALID == suite_context.default_queue) {
+ fprintf(stderr, "IPsec defaultq creation failed.\n");
+ return -1;
+ }
+ }
+
reass_test_vectors_init();
odp_ipsec_config_init(&ipsec_config);
@@ -1166,7 +1317,7 @@ int ipsec_config(odp_instance_t ODP_UNUSED inst)
ipsec_config.inbound_mode = suite_context.inbound_op_mode;
ipsec_config.outbound_mode = suite_context.outbound_op_mode;
ipsec_config.outbound.all_chksum = ~0;
- ipsec_config.inbound.default_queue = suite_context.queue;
+ ipsec_config.inbound.default_queue = suite_context.default_queue;
ipsec_config.inbound.parse_level = ODP_PROTO_LAYER_ALL;
ipsec_config.inbound.chksums.all_chksum = ~0;
ipsec_config.stats_en = true;
@@ -1242,7 +1393,7 @@ int ipsec_config(odp_instance_t ODP_UNUSED inst)
int ipsec_term(odp_instance_t inst)
{
odp_pool_t pool = suite_context.pool;
- odp_queue_t out_queue = suite_context.queue;
+ odp_queue_t default_queue = suite_context.default_queue;
/* suite_context.pktio is set to ODP_PKTIO_INVALID by ipsec_suite_init()
if inline processing is not supported. */
odp_pktio_t pktio = odp_pktio_lookup("loop");
@@ -1252,9 +1403,9 @@ int ipsec_term(odp_instance_t inst)
fprintf(stderr, "IPsec pktio close failed.\n");
}
- if (ODP_QUEUE_INVALID != out_queue) {
- if (odp_queue_destroy(out_queue))
- fprintf(stderr, "IPsec outq destroy failed.\n");
+ if (ODP_QUEUE_INVALID != default_queue) {
+ if (odp_queue_destroy(default_queue))
+ fprintf(stderr, "IPsec defaultq destroy failed.\n");
}
if (ODP_POOL_INVALID != pool) {
diff --git a/test/validation/api/ipsec/ipsec.h b/test/validation/api/ipsec/ipsec.h
index b899fce48..6edce03d0 100644
--- a/test/validation/api/ipsec/ipsec.h
+++ b/test/validation/api/ipsec/ipsec.h
@@ -29,7 +29,10 @@ int ipsec_config(odp_instance_t inst);
int ipsec_in_inline_init(void);
int ipsec_out_inline_init(void);
-int ipsec_suite_init(void);
+int ipsec_suite_sync_init(void);
+int ipsec_suite_plain_init(void);
+int ipsec_suite_sched_init(void);
+int ipsec_suite_term(void);
int ipsec_in_term(void);
int ipsec_out_term(void);
@@ -39,8 +42,10 @@ struct suite_context_s {
odp_ipsec_op_mode_t inbound_op_mode;
odp_ipsec_op_mode_t outbound_op_mode;
odp_pool_t pool;
+ odp_queue_t default_queue;
odp_queue_t queue;
odp_pktio_t pktio;
+ odp_queue_type_t q_type;
};
extern struct suite_context_s suite_context;
@@ -85,6 +90,8 @@ typedef struct {
int num_pkt;
struct {
odp_ipsec_op_status_t status;
+ odp_packet_reass_status_t reass_status;
+ uint16_t num_frags;
const ipsec_test_packet *pkt_res;
odp_proto_l3_type_t l3_type;
odp_proto_l4_type_t l4_type;
diff --git a/test/validation/api/ipsec/ipsec_async.c b/test/validation/api/ipsec/ipsec_async.c
index 8f818a94e..44c968a4d 100644
--- a/test/validation/api/ipsec/ipsec_async.c
+++ b/test/validation/api/ipsec/ipsec_async.c
@@ -10,6 +10,9 @@ static int ipsec_async_init(odp_instance_t *inst)
{
int rc;
+ suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
+ suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
+
rc = ipsec_init(inst, ODP_IPSEC_OP_MODE_ASYNC);
if (rc != 0)
return rc;
@@ -17,19 +20,19 @@ static int ipsec_async_init(odp_instance_t *inst)
suite_context.pool = odp_pool_lookup("packet_pool");
if (suite_context.pool == ODP_POOL_INVALID)
return -1;
- suite_context.queue = odp_queue_lookup("ipsec-out");
- if (suite_context.queue == ODP_QUEUE_INVALID)
- return -1;
-
- suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
- suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
return ipsec_config(*inst);
}
odp_suiteinfo_t ipsec_suites[] = {
- {"IPsec-in", ipsec_suite_init, ipsec_in_term, ipsec_in_suite},
- {"IPsec-out", ipsec_suite_init, ipsec_out_term, ipsec_out_suite},
+ {"IPsec-plain-in", ipsec_suite_plain_init, ipsec_suite_term,
+ ipsec_in_suite},
+ {"IPsec-sched-in", ipsec_suite_sched_init, ipsec_suite_term,
+ ipsec_in_suite},
+ {"IPsec-plain-out", ipsec_suite_plain_init, ipsec_suite_term,
+ ipsec_out_suite},
+ {"IPsec-sched-out", ipsec_suite_sched_init, ipsec_suite_term,
+ ipsec_out_suite},
ODP_SUITE_INFO_NULL,
};
diff --git a/test/validation/api/ipsec/ipsec_inline_in.c b/test/validation/api/ipsec/ipsec_inline_in.c
index bd34f6cc4..cbb3a178a 100644
--- a/test/validation/api/ipsec/ipsec_inline_in.c
+++ b/test/validation/api/ipsec/ipsec_inline_in.c
@@ -10,6 +10,9 @@ static int ipsec_sync_init(odp_instance_t *inst)
{
int rc;
+ suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_INLINE;
+ suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
+
rc = ipsec_init(inst, ODP_IPSEC_OP_MODE_INLINE);
if (rc != 0)
return rc;
@@ -17,21 +20,18 @@ static int ipsec_sync_init(odp_instance_t *inst)
suite_context.pool = odp_pool_lookup("packet_pool");
if (suite_context.pool == ODP_POOL_INVALID)
return -1;
- suite_context.queue = odp_queue_lookup("ipsec-out");
- if (suite_context.queue == ODP_QUEUE_INVALID)
- return -1;
suite_context.pktio = odp_pktio_lookup("loop");
if (suite_context.pktio == ODP_PKTIO_INVALID)
return -1;
- suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_INLINE;
- suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
-
return ipsec_config(*inst);
}
odp_suiteinfo_t ipsec_suites[] = {
- {"IPsec-in", ipsec_suite_init, ipsec_in_term, ipsec_in_suite},
+ {"IPsec-plain-in", ipsec_suite_plain_init, ipsec_suite_term,
+ ipsec_in_suite},
+ {"IPsec-sched-in", ipsec_suite_sched_init, ipsec_suite_term,
+ ipsec_in_suite},
ODP_SUITE_INFO_NULL,
};
diff --git a/test/validation/api/ipsec/ipsec_inline_out.c b/test/validation/api/ipsec/ipsec_inline_out.c
index 5cda43b74..3da19892b 100644
--- a/test/validation/api/ipsec/ipsec_inline_out.c
+++ b/test/validation/api/ipsec/ipsec_inline_out.c
@@ -10,6 +10,9 @@ static int ipsec_sync_init(odp_instance_t *inst)
{
int rc;
+ suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
+ suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_INLINE;
+
rc = ipsec_init(inst, ODP_IPSEC_OP_MODE_INLINE);
if (rc != 0)
return rc;
@@ -17,21 +20,18 @@ static int ipsec_sync_init(odp_instance_t *inst)
suite_context.pool = odp_pool_lookup("packet_pool");
if (suite_context.pool == ODP_POOL_INVALID)
return -1;
- suite_context.queue = odp_queue_lookup("ipsec-out");
- if (suite_context.queue == ODP_QUEUE_INVALID)
- return -1;
suite_context.pktio = odp_pktio_lookup("loop");
if (suite_context.pktio == ODP_PKTIO_INVALID)
return -1;
- suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
- suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_INLINE;
-
return ipsec_config(*inst);
}
odp_suiteinfo_t ipsec_suites[] = {
- {"IPsec-out", ipsec_suite_init, ipsec_out_term, ipsec_out_suite},
+ {"IPsec-plain-out", ipsec_suite_plain_init, ipsec_suite_term,
+ ipsec_out_suite},
+ {"IPsec-sched-out", ipsec_suite_sched_init, ipsec_suite_term,
+ ipsec_out_suite},
ODP_SUITE_INFO_NULL,
};
diff --git a/test/validation/api/ipsec/ipsec_sync.c b/test/validation/api/ipsec/ipsec_sync.c
index f77bb1c51..74ae1fe19 100644
--- a/test/validation/api/ipsec/ipsec_sync.c
+++ b/test/validation/api/ipsec/ipsec_sync.c
@@ -10,6 +10,9 @@ static int ipsec_sync_init(odp_instance_t *inst)
{
int rc;
+ suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_SYNC;
+ suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_SYNC;
+
rc = ipsec_init(inst, ODP_IPSEC_OP_MODE_SYNC);
if (rc != 0)
return rc;
@@ -18,15 +21,12 @@ static int ipsec_sync_init(odp_instance_t *inst)
if (suite_context.pool == ODP_POOL_INVALID)
return -1;
- suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_SYNC;
- suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_SYNC;
-
return ipsec_config(*inst);
}
odp_suiteinfo_t ipsec_suites[] = {
- {"IPsec-in", ipsec_suite_init, ipsec_in_term, ipsec_in_suite},
- {"IPsec-out", ipsec_suite_init, ipsec_out_term, ipsec_out_suite},
+ {"IPsec-in", ipsec_suite_sync_init, ipsec_in_term, ipsec_in_suite},
+ {"IPsec-out", ipsec_suite_sync_init, ipsec_out_term, ipsec_out_suite},
ODP_SUITE_INFO_NULL,
};
diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec/ipsec_test_in.c
index ef6996f1d..bcdcd4e83 100644
--- a/test/validation/api/ipsec/ipsec_test_in.c
+++ b/test/validation/api/ipsec/ipsec_test_in.c
@@ -1772,7 +1772,8 @@ static void test_multi_out_in(odp_ipsec_sa_t out_sa,
uint8_t tunnel_ip_ver,
int num_input_packets,
ipsec_test_packet *input_packets[],
- ipsec_test_packet *result_packet)
+ ipsec_test_packet *result_packet,
+ odp_packet_reass_status_t reass_status)
{
uint8_t ver_ihl = result_packet->data[result_packet->l3_offset];
odp_bool_t is_result_ipv6 = (ODPH_IPV4HDR_VER(ver_ihl) == ODPH_IPV6);
@@ -1800,6 +1801,8 @@ static void test_multi_out_in(odp_ipsec_sa_t out_sa,
if (i == num_input_packets - 1) {
part_prep_plain(&test_in, 1, is_result_ipv6, true);
test_in.out[0].pkt_res = result_packet;
+ test_in.out[0].reass_status = reass_status;
+ test_in.out[0].num_frags = num_input_packets;
}
ipsec_test_packet_from_pkt(&test_pkt, &pkt);
test_in.pkt_in = &test_pkt;
@@ -1820,7 +1823,8 @@ static void test_in_ipv4_esp_reass_success_two_frags(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV4,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv4_esp_reass_success_four_frags(odp_ipsec_sa_t out_sa,
@@ -1837,7 +1841,8 @@ static void test_in_ipv4_esp_reass_success_four_frags(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV4,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv4_esp_reass_success_two_frags_ooo(odp_ipsec_sa_t out_sa,
@@ -1852,7 +1857,8 @@ static void test_in_ipv4_esp_reass_success_two_frags_ooo(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV4,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv4_esp_reass_success_four_frags_ooo(odp_ipsec_sa_t out_sa,
@@ -1869,7 +1875,8 @@ static void test_in_ipv4_esp_reass_success_four_frags_ooo(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV4,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv4_esp_reass_incomp_missing(odp_ipsec_sa_t out_sa,
@@ -1883,7 +1890,8 @@ static void test_in_ipv4_esp_reass_incomp_missing(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV4,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_INCOMPLETE);
}
static void test_in_ipv4_esp_reass_success(void)
@@ -2001,7 +2009,8 @@ static void test_in_ipv6_esp_reass_success_two_frags(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV6,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv6_esp_reass_success_four_frags(odp_ipsec_sa_t out_sa,
@@ -2018,7 +2027,8 @@ static void test_in_ipv6_esp_reass_success_four_frags(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV6,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv6_esp_reass_success_two_frags_ooo(odp_ipsec_sa_t out_sa,
@@ -2033,7 +2043,8 @@ static void test_in_ipv6_esp_reass_success_two_frags_ooo(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV6,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv6_esp_reass_success_four_frags_ooo(odp_ipsec_sa_t out_sa,
@@ -2050,7 +2061,8 @@ static void test_in_ipv6_esp_reass_success_four_frags_ooo(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV6,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv6_esp_reass_incomp_missing(odp_ipsec_sa_t out_sa,
@@ -2064,7 +2076,8 @@ static void test_in_ipv6_esp_reass_incomp_missing(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV6,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_INCOMPLETE);
}
static void test_in_ipv6_esp_reass_success(void)
diff --git a/test/validation/api/ipsec/reass_test_vectors.c b/test/validation/api/ipsec/reass_test_vectors.c
new file mode 100644
index 000000000..c3bb2bfd4
--- /dev/null
+++ b/test/validation/api/ipsec/reass_test_vectors.c
@@ -0,0 +1,353 @@
+/* Copyright (c) 2021, Marvell
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "ipsec.h"
+
+/* The source file includes below test vectors */
+
+/* IPv6:
+ *
+ * 1) pkt_ipv6_udp_p1
+ * pkt_ipv6_udp_p1_f1
+ * pkt_ipv6_udp_p1_f2
+ *
+ * 2) pkt_ipv6_udp_p2
+ * pkt_ipv6_udp_p2_f1
+ * pkt_ipv6_udp_p2_f2
+ * pkt_ipv6_udp_p2_f3
+ * pkt_ipv6_udp_p2_f4
+ */
+
+/* IPv4:
+ *
+ * 1) pkt_ipv4_udp_p1
+ * pkt_ipv4_udp_p1_f1
+ * pkt_ipv4_udp_p1_f2
+ *
+ * 2) pkt_ipv4_udp_p2
+ * pkt_ipv4_udp_p2_f1
+ * pkt_ipv4_udp_p2_f2
+ * pkt_ipv4_udp_p2_f3
+ * pkt_ipv4_udp_p2_f4
+ */
+
+ipsec_test_packet pkt_ipv6_udp_p1 = {
+ .len = 1514,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 54,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x05, 0xb4, 0x11, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x05, 0xb4, 0x2b, 0xe8,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p1_f1 = {
+ .len = 1398,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x00, 0x01, 0x5c, 0x92, 0xac, 0xf1,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x05, 0xb4, 0x2b, 0xe8,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p1_f2 = {
+ .len = 186,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x00, 0x84, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x05, 0x38, 0x5c, 0x92, 0xac, 0xf1,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p2 = {
+ .len = 4496,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 54,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x11, 0x5a, 0x11, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x11, 0x5a, 0x8a, 0x11,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p2_f1 = {
+ .len = 1398,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x00, 0x01, 0x64, 0x6c, 0x68, 0x9f,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x11, 0x5a, 0x8a, 0x11,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p2_f2 = {
+ .len = 1398,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x05, 0x39, 0x64, 0x6c, 0x68, 0x9f,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p2_f3 = {
+ .len = 1398,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x0a, 0x71, 0x64, 0x6c, 0x68, 0x9f,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p2_f4 = {
+ .len = 496,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x01, 0xba, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x0f, 0xa8, 0x64, 0x6c, 0x68, 0x9f,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p1 = {
+ .len = 1514,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x05, 0xdc, 0x00, 0x01, 0x00, 0x00,
+ 0x40, 0x11, 0x66, 0x0d, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x05, 0xc8, 0xb8, 0x4c,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p1_f1 = {
+ .len = 1434,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x05, 0x8c, 0x00, 0x01, 0x20, 0x00,
+ 0x40, 0x11, 0x46, 0x5d, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x05, 0xc8, 0xb8, 0x4c,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p1_f2 = {
+ .len = 114,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x00, 0x64, 0x00, 0x01, 0x00, 0xaf,
+ 0x40, 0x11, 0x6a, 0xd6, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p2 = {
+ .len = 4496,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x11, 0x82, 0x00, 0x02, 0x00, 0x00,
+ 0x40, 0x11, 0x5a, 0x66, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x11, 0x6e, 0x16, 0x76,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p2_f1 = {
+ .len = 1434,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x20, 0x00,
+ 0x40, 0x11, 0x46, 0x5c, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x11, 0x6e, 0x16, 0x76,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p2_f2 = {
+ .len = 1434,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x20, 0xaf,
+ 0x40, 0x11, 0x45, 0xad, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p2_f3 = {
+ .len = 1434,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x21, 0x5e,
+ 0x40, 0x11, 0x44, 0xfe, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p2_f4 = {
+ .len = 296,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x01, 0x1a, 0x00, 0x02, 0x02, 0x0d,
+ 0x40, 0x11, 0x68, 0xc1, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+ },
+};
diff --git a/test/validation/api/ipsec/reass_test_vectors.h b/test/validation/api/ipsec/reass_test_vectors.h
index 4fbb1ebaf..02b41c573 100644
--- a/test/validation/api/ipsec/reass_test_vectors.h
+++ b/test/validation/api/ipsec/reass_test_vectors.h
@@ -7,351 +7,23 @@
#ifndef _ODP_REASS_TEST_VECTORS_H_
#define _ODP_REASS_TEST_VECTORS_H_
-/* The header file includes below test vectors */
-
-/* IPv6:
- *
- * 1) pkt_ipv6_udp_p1
- * pkt_ipv6_udp_p1_f1
- * pkt_ipv6_udp_p1_f2
- *
- * 2) pkt_ipv6_udp_p2
- * pkt_ipv6_udp_p2_f1
- * pkt_ipv6_udp_p2_f2
- * pkt_ipv6_udp_p2_f3
- * pkt_ipv6_udp_p2_f4
- */
-
-/* IPv4:
- *
- * 1) pkt_ipv4_udp_p1
- * pkt_ipv4_udp_p1_f1
- * pkt_ipv4_udp_p1_f2
- *
- * 2) pkt_ipv4_udp_p2
- * pkt_ipv4_udp_p2_f1
- * pkt_ipv4_udp_p2_f2
- * pkt_ipv4_udp_p2_f3
- * pkt_ipv4_udp_p2_f4
- */
-
-static ipsec_test_packet pkt_ipv6_udp_p1 = {
- .len = 1514,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 54,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x05, 0xb4, 0x11, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x05, 0xb4, 0x2b, 0xe8,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p1_f1 = {
- .len = 1398,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x00, 0x01, 0x5c, 0x92, 0xac, 0xf1,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x05, 0xb4, 0x2b, 0xe8,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p1_f2 = {
- .len = 186,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x84, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x05, 0x38, 0x5c, 0x92, 0xac, 0xf1,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p2 = {
- .len = 4496,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 54,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x11, 0x5a, 0x11, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x11, 0x5a, 0x8a, 0x11,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p2_f1 = {
- .len = 1398,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x00, 0x01, 0x64, 0x6c, 0x68, 0x9f,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x11, 0x5a, 0x8a, 0x11,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p2_f2 = {
- .len = 1398,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x05, 0x39, 0x64, 0x6c, 0x68, 0x9f,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p2_f3 = {
- .len = 1398,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x0a, 0x71, 0x64, 0x6c, 0x68, 0x9f,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p2_f4 = {
- .len = 496,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x01, 0xba, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x0f, 0xa8, 0x64, 0x6c, 0x68, 0x9f,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p1 = {
- .len = 1514,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x05, 0xdc, 0x00, 0x01, 0x00, 0x00,
- 0x40, 0x11, 0x66, 0x0d, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x05, 0xc8, 0xb8, 0x4c,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p1_f1 = {
- .len = 1434,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x05, 0x8c, 0x00, 0x01, 0x20, 0x00,
- 0x40, 0x11, 0x46, 0x5d, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x05, 0xc8, 0xb8, 0x4c,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p1_f2 = {
- .len = 114,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x00, 0x64, 0x00, 0x01, 0x00, 0xaf,
- 0x40, 0x11, 0x6a, 0xd6, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p2 = {
- .len = 4496,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x11, 0x82, 0x00, 0x02, 0x00, 0x00,
- 0x40, 0x11, 0x5a, 0x66, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x11, 0x6e, 0x16, 0x76,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p2_f1 = {
- .len = 1434,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x20, 0x00,
- 0x40, 0x11, 0x46, 0x5c, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x11, 0x6e, 0x16, 0x76,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p2_f2 = {
- .len = 1434,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x20, 0xaf,
- 0x40, 0x11, 0x45, 0xad, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p2_f3 = {
- .len = 1434,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x21, 0x5e,
- 0x40, 0x11, 0x44, 0xfe, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p2_f4 = {
- .len = 296,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x01, 0x1a, 0x00, 0x02, 0x02, 0x0d,
- 0x40, 0x11, 0x68, 0xc1, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
- },
-};
+extern ipsec_test_packet pkt_ipv6_udp_p1;
+extern ipsec_test_packet pkt_ipv6_udp_p1_f1;
+extern ipsec_test_packet pkt_ipv6_udp_p1_f2;
+extern ipsec_test_packet pkt_ipv6_udp_p2;
+extern ipsec_test_packet pkt_ipv6_udp_p2_f1;
+extern ipsec_test_packet pkt_ipv6_udp_p2_f2;
+extern ipsec_test_packet pkt_ipv6_udp_p2_f3;
+extern ipsec_test_packet pkt_ipv6_udp_p2_f4;
+
+extern ipsec_test_packet pkt_ipv4_udp_p1;
+extern ipsec_test_packet pkt_ipv4_udp_p1_f1;
+extern ipsec_test_packet pkt_ipv4_udp_p1_f2;
+extern ipsec_test_packet pkt_ipv4_udp_p2;
+extern ipsec_test_packet pkt_ipv4_udp_p2_f1;
+extern ipsec_test_packet pkt_ipv4_udp_p2_f2;
+extern ipsec_test_packet pkt_ipv4_udp_p2_f3;
+extern ipsec_test_packet pkt_ipv4_udp_p2_f4;
static inline void
test_vector_payload_populate(ipsec_test_packet *pkt, odp_bool_t first_frag)
diff --git a/test/validation/api/pool/pool.c b/test/validation/api/pool/pool.c
index d791063e2..861ac18ae 100644
--- a/test/validation/api/pool/pool.c
+++ b/test/validation/api/pool/pool.c
@@ -893,6 +893,63 @@ static void pool_test_pool_index(void)
}
}
+static void pool_test_create_max_pkt_pools(void)
+{
+ uint32_t max_pools = global_pool_capa.pkt.max_pools;
+ uint32_t i, num_pools, num_shm;
+ odp_pool_t pool[max_pools];
+ odp_pool_param_t param;
+ odp_shm_capability_t shm_capa;
+ uint32_t shm_size = 32;
+ uint32_t uarea_size = 32;
+
+ CU_ASSERT_FATAL(max_pools > 0);
+
+ /* Reserve maximum number of SHM blocks */
+ CU_ASSERT_FATAL(odp_shm_capability(&shm_capa) == 0);
+ CU_ASSERT_FATAL(shm_capa.max_blocks > 0);
+
+ odp_shm_t shm[shm_capa.max_blocks];
+
+ if (shm_capa.max_size && shm_capa.max_size < shm_size)
+ shm_size = shm_capa.max_size;
+
+ for (i = 0; i < shm_capa.max_blocks; i++) {
+ shm[i] = odp_shm_reserve(NULL, shm_size, 0, 0);
+
+ if (shm[i] == ODP_SHM_INVALID)
+ break;
+ }
+ num_shm = i;
+ CU_ASSERT(num_shm == shm_capa.max_blocks);
+
+ /* Create maximum number of packet pools */
+ if (global_pool_capa.pkt.max_uarea_size && global_pool_capa.pkt.max_uarea_size < uarea_size)
+ uarea_size = global_pool_capa.pkt.max_uarea_size;
+
+ odp_pool_param_init(&param);
+ param.type = ODP_POOL_PACKET;
+ param.pkt.len = PKT_LEN;
+ param.pkt.num = 1;
+ param.pkt.max_num = 1;
+ param.pkt.uarea_size = uarea_size;
+
+ for (i = 0; i < max_pools; i++) {
+ pool[i] = odp_pool_create(NULL, &param);
+
+ if (pool[i] == ODP_POOL_INVALID)
+ break;
+ }
+ num_pools = i;
+ CU_ASSERT(num_pools == max_pools);
+
+ for (i = 0; i < num_pools; i++)
+ CU_ASSERT(odp_pool_destroy(pool[i]) == 0);
+
+ for (i = 0; i < num_shm; i++)
+ CU_ASSERT(odp_shm_free(shm[i]) == 0);
+}
+
static int pool_check_buffer_pool_statistics(void)
{
if (global_pool_capa.buf.stats.all == 0)
@@ -1706,6 +1763,7 @@ odp_testinfo_t pool_suite[] = {
ODP_TEST_INFO(pool_test_tmo_max_num),
ODP_TEST_INFO(pool_test_create_after_fork),
ODP_TEST_INFO(pool_test_pool_index),
+ ODP_TEST_INFO(pool_test_create_max_pkt_pools),
ODP_TEST_INFO_CONDITIONAL(pool_test_buffer_pool_statistics,
pool_check_buffer_pool_statistics),
ODP_TEST_INFO_CONDITIONAL(pool_test_packet_pool_statistics,