@@ -7,30 +7,6 @@ AC_CONFIG_FILES([test/Makefile
test/miscellaneous/Makefile
test/performance/Makefile
test/validation/Makefile
- test/validation/api/atomic/Makefile
- test/validation/api/barrier/Makefile
- test/validation/api/buffer/Makefile
- test/validation/api/chksum/Makefile
- test/validation/api/classification/Makefile
- test/validation/api/cpumask/Makefile
- test/validation/api/crypto/Makefile
- test/validation/api/errno/Makefile
- test/validation/api/event/Makefile
- test/validation/api/hash/Makefile
- test/validation/api/init/Makefile
- test/validation/api/ipsec/Makefile
- test/validation/api/lock/Makefile
test/validation/api/Makefile
- test/validation/api/packet/Makefile
test/validation/api/pktio/Makefile
- test/validation/api/pool/Makefile
- test/validation/api/queue/Makefile
- test/validation/api/random/Makefile
- test/validation/api/scheduler/Makefile
- test/validation/api/shmem/Makefile
- test/validation/api/std_clib/Makefile
- test/validation/api/system/Makefile
- test/validation/api/thread/Makefile
- test/validation/api/time/Makefile
- test/validation/api/timer/Makefile
test/validation/api/traffic_mngr/Makefile])
@@ -1,3 +1,32 @@
*.log
*.trs
tests-validation.env
+atomic_main
+barrier_main
+buffer_main
+chksum_main
+classification_main
+cpumask_main
+crypto_main
+errno_main
+event_main
+hash_main
+init_main_abort
+init_main_log
+init_main_ok
+ipsec_async
+ipsec_inline_in
+ipsec_inline_out
+ipsec_sync
+lock_main
+packet_main
+pool_main
+queue_main
+random_main
+scheduler_main
+shmem_main
+std_clib_main
+system_main
+thread_main
+time_main
+timer_main
@@ -1,66 +1,127 @@
-ODP_MODULES = atomic \
- barrier \
- buffer \
- chksum \
- classification \
- cpumask \
- crypto \
- errno \
- event \
- hash \
- init \
- ipsec \
- lock \
- queue \
- packet \
+ODP_MODULES = \
pktio \
- pool \
- random \
- scheduler \
- std_clib \
- thread \
- time \
- timer \
- traffic_mngr \
- shmem \
- system
+ traffic_mngr
SUBDIRS = $(ODP_MODULES)
-include $(top_srcdir)/test/Makefile.inc
+include Makefile.inc
+
+test_PROGRAMS = \
+ atomic_main \
+ barrier_main \
+ buffer_main \
+ chksum_main \
+ classification_main \
+ cpumask_main \
+ crypto_main \
+ errno_main \
+ event_main \
+ hash_main \
+ init_main_abort \
+ init_main_log \
+ init_main_ok \
+ ipsec_async \
+ ipsec_inline_in \
+ ipsec_inline_out \
+ ipsec_sync \
+ lock_main \
+ packet_main \
+ pool_main \
+ queue_main \
+ random_main \
+ scheduler_main \
+ shmem_main \
+ std_clib_main \
+ system_main \
+ thread_main \
+ time_main \
+ timer_main
+
+noinst_LTLIBRARIES = libtestipsec.la
+libtestipsec_la_SOURCES = \
+ ipsec_test_vectors.h \
+ ipsec_test_in.c \
+ ipsec_test_out.c \
+ ipsec.h \
+ ipsec.c
+
+atomic_main_SOURCES = atomic.c
+barrier_main_SOURCES = barrier.c
+buffer_main_SOURCES = buffer.c
+chksum_main_SOURCES = chksum.c
+cpumask_main_SOURCES = cpumask.c
+cpumask_main_LDADD = $(LDADD) $(LIBCPUMASK_COMMON)
+crypto_main_SOURCES = crypto.c crypto_test_vectors.h
+errno_main_SOURCES = errno.c
+event_main_SOURCES = event.c
+hash_main_SOURCES = hash.c
+init_main_abort_SOURCES = init_main_abort.c
+init_main_log_SOURCES = init_main_log.c
+init_main_ok_SOURCES = init_main_ok.c
+ipsec_sync_SOURCES = ipsec_sync.c
+ipsec_sync_LDADD = $(LDADD) libtestipsec.la
+ipsec_async_SOURCES = ipsec_async.c
+ipsec_async_LDADD = $(LDADD) libtestipsec.la
+ipsec_inline_in_SOURCES = ipsec_inline_in.c
+ipsec_inline_in_LDADD = $(LDADD) libtestipsec.la
+ipsec_inline_out_SOURCES = ipsec_inline_out.c
+ipsec_inline_out_LDADD = $(LDADD) libtestipsec.la
+lock_main_SOURCES = lock.c
+packet_main_SOURCES = packet.c
+pool_main_SOURCES = pool.c
+queue_main_SOURCES = queue.c
+random_main_SOURCES = random.c
+scheduler_main_SOURCES = scheduler.c
+shmem_main_SOURCES = shmem.c
+std_clib_main_SOURCES = std_clib.c
+system_main_SOURCES = system.c
+thread_main_SOURCES = thread.c
+thread_main_LDADD = $(LDADD) $(LIBTHRMASK_COMMON)
+time_main_SOURCES = time.c
+timer_main_SOURCES = timer.c
+
+classification_main_SOURCES = \
+ classification_basic.c \
+ classification_tests.c \
+ classification_testsuites.h \
+ classification_test_pmr.c \
+ classification_common.c \
+ classification.c \
+ classification.h
+
TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
TESTS = \
- atomic/atomic_main$(EXEEXT) \
- barrier/barrier_main$(EXEEXT) \
- buffer/buffer_main$(EXEEXT) \
- chksum/chksum_main$(EXEEXT) \
- classification/classification_main$(EXEEXT) \
- cpumask/cpumask_main$(EXEEXT) \
- crypto/crypto_main$(EXEEXT) \
- errno/errno_main$(EXEEXT) \
- event/event_main$(EXEEXT) \
- hash/hash_main$(EXEEXT) \
- init/init_main_ok$(EXEEXT) \
- init/init_main_abort$(EXEEXT) \
- init/init_main_log$(EXEEXT) \
- ipsec/ipsec_sync$(EXEEXT) \
- ipsec/ipsec_async$(EXEEXT) \
- ipsec/ipsec_inline_in$(EXEEXT) \
- ipsec/ipsec_inline_out$(EXEEXT) \
- lock/lock_main$(EXEEXT) \
- packet/packet_main$(EXEEXT) \
- pool/pool_main$(EXEEXT) \
- queue/queue_main$(EXEEXT) \
- random/random_main$(EXEEXT) \
- scheduler/scheduler_main$(EXEEXT) \
- std_clib/std_clib_main$(EXEEXT) \
- thread/thread_main$(EXEEXT) \
- time/time_main$(EXEEXT) \
- timer/timer_main$(EXEEXT) \
- traffic_mngr/traffic_mngr.sh \
- shmem/shmem_main$(EXEEXT) \
- system/system_main$(EXEEXT)
+ atomic_main$(EXEEXT) \
+ barrier_main$(EXEEXT) \
+ buffer_main$(EXEEXT) \
+ chksum_main$(EXEEXT) \
+ classification_main$(EXEEXT) \
+ cpumask_main$(EXEEXT) \
+ crypto_main$(EXEEXT) \
+ errno_main$(EXEEXT) \
+ event_main$(EXEEXT) \
+ hash_main$(EXEEXT) \
+ init_main_ok$(EXEEXT) \
+ init_main_abort$(EXEEXT) \
+ init_main_log$(EXEEXT) \
+ ipsec_sync$(EXEEXT) \
+ ipsec_async$(EXEEXT) \
+ ipsec_inline_in$(EXEEXT) \
+ ipsec_inline_out$(EXEEXT) \
+ lock_main$(EXEEXT) \
+ packet_main$(EXEEXT) \
+ pool_main$(EXEEXT) \
+ queue_main$(EXEEXT) \
+ random_main$(EXEEXT) \
+ scheduler_main$(EXEEXT) \
+ shmem_main$(EXEEXT) \
+ std_clib_main$(EXEEXT) \
+ system_main$(EXEEXT) \
+ thread_main$(EXEEXT) \
+ time_main$(EXEEXT) \
+ timer_main$(EXEEXT) \
+ traffic_mngr/traffic_mngr.sh
TESTNAME = validation
similarity index 100%
rename from test/validation/api/atomic/atomic.c
rename to test/validation/api/atomic.c
deleted file mode 100644
@@ -1 +0,0 @@
-atomic_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = atomic_main
-atomic_main_SOURCES = atomic.c
similarity index 100%
rename from test/validation/api/barrier/barrier.c
rename to test/validation/api/barrier.c
deleted file mode 100644
@@ -1 +0,0 @@
-barrier_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = barrier_main
-barrier_main_SOURCES = barrier.c
similarity index 100%
rename from test/validation/api/buffer/buffer.c
rename to test/validation/api/buffer.c
deleted file mode 100644
@@ -1 +0,0 @@
-buffer_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = buffer_main
-buffer_main_SOURCES = buffer.c
similarity index 100%
rename from test/validation/api/chksum/chksum.c
rename to test/validation/api/chksum.c
deleted file mode 100644
@@ -1 +0,0 @@
-chksum_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = chksum_main
-chksum_main_SOURCES = chksum.c
similarity index 95%
rename from test/validation/api/classification/classification.c
rename to test/validation/api/classification.c
@@ -8,7 +8,7 @@
#include <odp_api.h>
#include <odp_cunit_common.h>
-#include "odp_classification_testsuites.h"
+#include "classification_testsuites.h"
#include "classification.h"
odp_suiteinfo_t classification_suites[] = {
similarity index 100%
rename from test/validation/api/classification/classification.h
rename to test/validation/api/classification.h
deleted file mode 100644
@@ -1 +0,0 @@
-classification_main
deleted file mode 100644
@@ -1,11 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = classification_main
-classification_main_SOURCES = \
- odp_classification_basic.c \
- odp_classification_tests.c \
- odp_classification_testsuites.h \
- odp_classification_test_pmr.c \
- odp_classification_common.c \
- classification.c \
- classification.h
deleted file mode 100644
@@ -1,336 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include "config.h"
-
-#include <odp_cunit_common.h>
-#include "odp_classification_testsuites.h"
-#include "classification.h"
-
-#define PMR_SET_NUM 5
-
-static void classification_test_create_cos(void)
-{
- odp_cos_t cos;
- odp_cls_cos_param_t cls_param;
- odp_pool_t pool;
- odp_queue_t queue;
-
- pool = pool_create("cls_basic_pool");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- queue = queue_create("cls_basic_queue", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(NULL, &cls_param);
- CU_ASSERT(odp_cos_to_u64(cos) != odp_cos_to_u64(ODP_COS_INVALID));
- odp_cos_destroy(cos);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
-}
-
-static void classification_test_destroy_cos(void)
-{
- odp_cos_t cos;
- char name[ODP_COS_NAME_LEN];
- odp_pool_t pool;
- odp_queue_t queue;
- odp_cls_cos_param_t cls_param;
- int retval;
-
- pool = pool_create("cls_basic_pool");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- queue = queue_create("cls_basic_queue", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- sprintf(name, "ClassOfService");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(name, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
- retval = odp_cos_destroy(cos);
- CU_ASSERT(retval == 0);
- retval = odp_cos_destroy(ODP_COS_INVALID);
- CU_ASSERT(retval < 0);
-
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
-}
-
-static void classification_test_create_pmr_match(void)
-{
- odp_pmr_t pmr;
- uint16_t val;
- uint16_t mask;
- int retval;
- odp_pmr_param_t pmr_param;
- odp_cos_t default_cos;
- odp_cos_t cos;
- odp_queue_t default_queue;
- odp_queue_t queue;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t pkt_pool;
- odp_cls_cos_param_t cls_param;
- odp_pktio_t pktio;
-
- pkt_pool = pool_create("pkt_pool");
- CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID);
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("pmr_match", true);
- CU_ASSERT(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("pmr_match");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create("pmr_match", &cls_param);
- CU_ASSERT(cos != ODP_COS_INVALID);
-
- val = 1024;
- mask = 0xffff;
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = find_first_supported_l3_pmr();
- pmr_param.range_term = false;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
- CU_ASSERT(odp_pmr_to_u64(pmr) != odp_pmr_to_u64(ODP_PMR_INVAL));
- /* destroy the created PMR */
- retval = odp_cls_pmr_destroy(pmr);
- CU_ASSERT(retval == 0);
-
- /* destroy an INVALID PMR */
- retval = odp_cls_pmr_destroy(ODP_PMR_INVAL);
- CU_ASSERT(retval < 0);
-
- odp_queue_destroy(queue);
- odp_pool_destroy(pool);
- odp_pool_destroy(pkt_pool);
- odp_cos_destroy(cos);
- odp_queue_destroy(default_queue);
- odp_pool_destroy(default_pool);
- odp_cos_destroy(default_cos);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_cos_set_queue(void)
-{
- int retval;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pool_t pool;
- odp_queue_t queue;
- odp_queue_t queue_cos;
- odp_cos_t cos_queue;
- odp_queue_t recvqueue;
- odp_queue_t queue_out = ODP_QUEUE_INVALID;
-
- pool = pool_create("cls_basic_pool");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- queue = queue_create("cls_basic_queue", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- sprintf(cosname, "CoSQueue");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
- cos_queue = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos_queue != ODP_COS_INVALID);
-
- queue_cos = queue_create("QueueCoS", true);
- CU_ASSERT_FATAL(queue_cos != ODP_QUEUE_INVALID);
-
- retval = odp_cos_queue_set(cos_queue, queue_cos);
- CU_ASSERT(retval == 0);
- recvqueue = odp_cos_queue(cos_queue);
- CU_ASSERT(recvqueue == queue_cos);
- CU_ASSERT(odp_cls_cos_num_queue(cos_queue) == 1);
- CU_ASSERT(odp_cls_cos_queues(cos_queue, &queue_out, 1) == 1);
- CU_ASSERT(queue_out == queue_cos);
-
- odp_cos_destroy(cos_queue);
- odp_queue_destroy(queue_cos);
- odp_queue_destroy(queue);
- odp_pool_destroy(pool);
-}
-
-static void classification_test_cos_set_pool(void)
-{
- int retval;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pool_t pool;
- odp_queue_t queue;
- odp_pool_t cos_pool;
- odp_cos_t cos;
- odp_pool_t recvpool;
-
- pool = pool_create("cls_basic_pool");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- queue = queue_create("cls_basic_queue", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- sprintf(cosname, "CoSQueue");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- cos_pool = pool_create("PoolCoS");
- CU_ASSERT_FATAL(cos_pool != ODP_POOL_INVALID);
-
- retval = odp_cls_cos_pool_set(cos, cos_pool);
- CU_ASSERT(retval == 0);
- recvpool = odp_cls_cos_pool(cos);
- CU_ASSERT(recvpool == cos_pool);
-
- odp_cos_destroy(cos);
- odp_queue_destroy(queue);
- odp_pool_destroy(pool);
- odp_pool_destroy(cos_pool);
-}
-
-static void classification_test_cos_set_drop(void)
-{
- int retval;
- char cosname[ODP_COS_NAME_LEN];
- odp_cos_t cos_drop;
- odp_queue_t queue;
- odp_pool_t pool;
- odp_cls_cos_param_t cls_param;
-
- pool = pool_create("cls_basic_pool");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- queue = queue_create("cls_basic_queue", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- sprintf(cosname, "CoSDrop");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
- cos_drop = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos_drop != ODP_COS_INVALID);
-
- retval = odp_cos_drop_set(cos_drop, ODP_COS_DROP_POOL);
- CU_ASSERT(retval == 0);
- CU_ASSERT(ODP_COS_DROP_POOL == odp_cos_drop(cos_drop));
-
- retval = odp_cos_drop_set(cos_drop, ODP_COS_DROP_NEVER);
- CU_ASSERT(retval == 0);
- CU_ASSERT(ODP_COS_DROP_NEVER == odp_cos_drop(cos_drop));
- odp_cos_destroy(cos_drop);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
-}
-
-static void classification_test_pmr_composite_create(void)
-{
- odp_pmr_t pmr_composite;
- int retval;
- odp_pmr_param_t pmr_terms[PMR_SET_NUM];
- odp_cos_t default_cos;
- odp_cos_t cos;
- odp_queue_t default_queue;
- odp_queue_t queue;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t pkt_pool;
- odp_cls_cos_param_t cls_param;
- odp_pktio_t pktio;
- uint16_t val = 1024;
- uint16_t mask = 0xffff;
- int i;
-
- pkt_pool = pool_create("pkt_pool");
- CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID);
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("pmr_match", true);
- CU_ASSERT(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("pmr_match");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create("pmr_match", &cls_param);
- CU_ASSERT(cos != ODP_COS_INVALID);
-
- for (i = 0; i < PMR_SET_NUM; i++) {
- odp_cls_pmr_param_init(&pmr_terms[i]);
- pmr_terms[i].term = ODP_PMR_TCP_DPORT;
- pmr_terms[i].match.value = &val;
- pmr_terms[i].range_term = false;
- pmr_terms[i].match.mask = &mask;
- pmr_terms[i].val_sz = sizeof(val);
- }
-
- pmr_composite = odp_cls_pmr_create(pmr_terms, PMR_SET_NUM,
- default_cos, cos);
- CU_ASSERT(odp_pmr_to_u64(pmr_composite) !=
- odp_pmr_to_u64(ODP_PMR_INVAL));
-
- retval = odp_cls_pmr_destroy(pmr_composite);
- CU_ASSERT(retval == 0);
-
- odp_queue_destroy(queue);
- odp_pool_destroy(pool);
- odp_pool_destroy(pkt_pool);
- odp_cos_destroy(cos);
- odp_queue_destroy(default_queue);
- odp_pool_destroy(default_pool);
- odp_cos_destroy(default_cos);
- odp_pktio_close(pktio);
-}
-
-odp_testinfo_t classification_suite_basic[] = {
- ODP_TEST_INFO(classification_test_create_cos),
- ODP_TEST_INFO(classification_test_destroy_cos),
- ODP_TEST_INFO(classification_test_create_pmr_match),
- ODP_TEST_INFO(classification_test_cos_set_queue),
- ODP_TEST_INFO(classification_test_cos_set_drop),
- ODP_TEST_INFO(classification_test_cos_set_pool),
- ODP_TEST_INFO(classification_test_pmr_composite_create),
- ODP_TEST_INFO_NULL,
-};
deleted file mode 100644
@@ -1,428 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include "config.h"
-
-#include "odp_classification_testsuites.h"
-#include "classification.h"
-#include <odp_cunit_common.h>
-#include "test_debug.h"
-
-typedef struct cls_test_packet {
- odp_u32be_t magic;
- odp_u32be_t seq;
-} cls_test_packet_t;
-
-static uint8_t IPV6_SRC_ADDR[ODPH_IPV6ADDR_LEN] = {
- /* I.e. ::ffff:10.0.0.1 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 10, 0, 0, 1
-};
-
-static uint8_t IPV6_DST_ADDR[ODPH_IPV6ADDR_LEN] = {
- /* I.e. ::ffff:10.0.0.100 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 10, 0, 0, 100
-};
-
-odp_pktio_t create_pktio(odp_queue_type_t q_type, odp_pool_t pool,
- odp_bool_t cls_enable)
-{
- odp_pktio_t pktio;
- odp_pktio_param_t pktio_param;
- odp_pktin_queue_param_t pktin_param;
- int ret;
-
- if (pool == ODP_POOL_INVALID)
- return ODP_PKTIO_INVALID;
-
- odp_pktio_param_init(&pktio_param);
- if (q_type == ODP_QUEUE_TYPE_PLAIN)
- pktio_param.in_mode = ODP_PKTIN_MODE_QUEUE;
- else
- pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
-
- pktio = odp_pktio_open("loop", pool, &pktio_param);
- if (pktio == ODP_PKTIO_INVALID) {
- ret = odp_pool_destroy(pool);
- if (ret)
- fprintf(stderr, "unable to destroy pool.\n");
- return ODP_PKTIO_INVALID;
- }
-
- odp_pktin_queue_param_init(&pktin_param);
- pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;
- pktin_param.classifier_enable = cls_enable;
- pktin_param.hash_enable = false;
-
- if (odp_pktin_queue_config(pktio, &pktin_param)) {
- fprintf(stderr, "pktin queue config failed.\n");
- return ODP_PKTIO_INVALID;
- }
-
- if (odp_pktout_queue_config(pktio, NULL)) {
- fprintf(stderr, "pktout queue config failed.\n");
- return ODP_PKTIO_INVALID;
- }
-
- return pktio;
-}
-
-int stop_pktio(odp_pktio_t pktio)
-{
- odp_event_t ev;
-
- if (odp_pktio_stop(pktio)) {
- fprintf(stderr, "pktio stop failed.\n");
- return -1;
- }
-
- while (1) {
- ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
-
- if (ev != ODP_EVENT_INVALID)
- odp_event_free(ev);
- else
- break;
- }
-
- return 0;
-}
-
-int cls_pkt_set_seq(odp_packet_t pkt)
-{
- static uint32_t seq;
- cls_test_packet_t data;
- uint32_t offset;
- odph_ipv4hdr_t *ip;
- odph_tcphdr_t *tcp;
- int status;
-
- data.magic = DATA_MAGIC;
- data.seq = ++seq;
-
- ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
- offset = odp_packet_l4_offset(pkt);
- CU_ASSERT_FATAL(offset != ODP_PACKET_OFFSET_INVALID);
-
- if (ip->proto == ODPH_IPPROTO_UDP)
- status = odp_packet_copy_from_mem(pkt, offset + ODPH_UDPHDR_LEN,
- sizeof(data), &data);
- else {
- tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- status = odp_packet_copy_from_mem(pkt, offset + tcp->hl * 4,
- sizeof(data), &data);
- }
-
- return status;
-}
-
-uint32_t cls_pkt_get_seq(odp_packet_t pkt)
-{
- uint32_t offset;
- cls_test_packet_t data;
- odph_ipv4hdr_t *ip;
- odph_tcphdr_t *tcp;
-
- ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
- offset = odp_packet_l4_offset(pkt);
-
- if (offset == ODP_PACKET_OFFSET_INVALID || ip == NULL)
- return TEST_SEQ_INVALID;
-
- if (ip->proto == ODPH_IPPROTO_UDP)
- odp_packet_copy_to_mem(pkt, offset + ODPH_UDPHDR_LEN,
- sizeof(data), &data);
- else {
- tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- odp_packet_copy_to_mem(pkt, offset + tcp->hl * 4,
- sizeof(data), &data);
- }
-
- if (data.magic == DATA_MAGIC)
- return data.seq;
-
- return TEST_SEQ_INVALID;
-}
-
-int parse_ipv4_string(const char *ipaddress, uint32_t *addr, uint32_t *mask)
-{
- int b[4];
- int qualifier = 32;
- int converted;
-
- if (strchr(ipaddress, '/')) {
- converted = sscanf(ipaddress, "%d.%d.%d.%d/%d",
- &b[3], &b[2], &b[1], &b[0],
- &qualifier);
- if (5 != converted)
- return -1;
- } else {
- converted = sscanf(ipaddress, "%d.%d.%d.%d",
- &b[3], &b[2], &b[1], &b[0]);
- if (4 != converted)
- return -1;
- }
-
- if ((b[0] > 255) || (b[1] > 255) || (b[2] > 255) || (b[3] > 255))
- return -1;
- if (!qualifier || (qualifier > 32))
- return -1;
-
- *addr = b[0] | b[1] << 8 | b[2] << 16 | b[3] << 24;
- if (mask)
- *mask = ~(0xFFFFFFFF & ((1ULL << (32 - qualifier)) - 1));
-
- return 0;
-}
-
-void enqueue_pktio_interface(odp_packet_t pkt, odp_pktio_t pktio)
-{
- odp_pktout_queue_t pktout;
-
- CU_ASSERT_FATAL(odp_pktout_queue(pktio, &pktout, 1) == 1);
- CU_ASSERT(odp_pktout_send(pktout, &pkt, 1) == 1);
-}
-
-odp_packet_t receive_packet(odp_queue_t *queue, uint64_t ns)
-{
- odp_event_t ev;
-
- ev = odp_schedule(queue, ns);
- return odp_packet_from_event(ev);
-}
-
-odp_queue_t queue_create(const char *queuename, bool sched)
-{
- odp_queue_t queue;
- odp_queue_param_t qparam;
-
- if (sched) {
- odp_queue_param_init(&qparam);
- qparam.type = ODP_QUEUE_TYPE_SCHED;
- qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST;
- qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL;
- qparam.sched.group = ODP_SCHED_GROUP_ALL;
-
- queue = odp_queue_create(queuename, &qparam);
- } else {
- queue = odp_queue_create(queuename, NULL);
- }
-
- return queue;
-}
-
-odp_pool_t pool_create(const char *poolname)
-{
- odp_pool_param_t param;
-
- odp_pool_param_init(¶m);
- param.pkt.seg_len = SHM_PKT_BUF_SIZE;
- param.pkt.len = SHM_PKT_BUF_SIZE;
- param.pkt.num = SHM_PKT_NUM_BUFS;
- param.type = ODP_POOL_PACKET;
-
- return odp_pool_create(poolname, ¶m);
-}
-
-odp_packet_t create_packet(cls_packet_info_t pkt_info)
-{
- uint32_t seqno;
- odph_ethhdr_t *ethhdr;
- odph_udphdr_t *udp;
- odph_tcphdr_t *tcp;
- odph_ipv4hdr_t *ip;
- odph_ipv6hdr_t *ipv6;
- uint16_t payload_len;
- uint64_t src_mac = CLS_DEFAULT_SMAC;
- uint64_t dst_mac = CLS_DEFAULT_DMAC;
- uint64_t dst_mac_be;
- uint32_t addr = 0;
- uint32_t mask;
- odp_packet_t pkt;
- int packet_len = 0;
- uint32_t version, tc, flow, ver_tc_flow;
- uint8_t *buf, next_hdr;
- uint32_t l4_len, l3_len, l2_len, l3_offset, l4_offset;
- uint16_t vlan_hdr_len = 0;
- uint16_t l2_hdr_len = 0;
- uint16_t l3_hdr_len = 0;
- uint16_t l4_hdr_len = 0;
- uint16_t eth_type;
- odp_u16be_t *vlan_type;
- odph_vlanhdr_t *vlan_hdr;
-
- /* 48 bit ethernet address needs to be left shifted for proper
- value after changing to be*/
- dst_mac_be = odp_cpu_to_be_64(dst_mac);
- if (dst_mac != dst_mac_be)
- dst_mac_be = dst_mac_be >> (64 - 8 * ODPH_ETHADDR_LEN);
-
- payload_len = sizeof(cls_test_packet_t) + pkt_info.len;
- seqno = odp_atomic_fetch_inc_u32(pkt_info.seq);
-
- vlan_hdr_len = pkt_info.vlan ? ODPH_VLANHDR_LEN : 0;
- vlan_hdr_len = pkt_info.vlan_qinq ? 2 * vlan_hdr_len : vlan_hdr_len;
- l3_hdr_len = pkt_info.ipv6 ? ODPH_IPV6HDR_LEN : ODPH_IPV4HDR_LEN;
- l4_hdr_len = pkt_info.udp ? ODPH_UDPHDR_LEN : ODPH_TCPHDR_LEN;
- eth_type = pkt_info.ipv6 ? ODPH_ETHTYPE_IPV6 : ODPH_ETHTYPE_IPV4;
- next_hdr = pkt_info.udp ? ODPH_IPPROTO_UDP : ODPH_IPPROTO_TCP;
- l2_hdr_len = ODPH_ETHHDR_LEN + vlan_hdr_len;
- l4_len = l4_hdr_len + payload_len;
- l3_len = l3_hdr_len + l4_len;
- l2_len = l2_hdr_len + l3_len;
- packet_len = l2_len;
-
- pkt = odp_packet_alloc(pkt_info.pool, packet_len);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
-
- /* Ethernet Header */
- buf = odp_packet_data(pkt);
- odp_packet_l2_offset_set(pkt, 0);
- ethhdr = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- memcpy(ethhdr->src.addr, &src_mac, ODPH_ETHADDR_LEN);
- memcpy(ethhdr->dst.addr, &dst_mac_be, ODPH_ETHADDR_LEN);
- vlan_type = (odp_u16be_t *)(void *)ðhdr->type;
- vlan_hdr = (odph_vlanhdr_t *)(ethhdr + 1);
-
- if (pkt_info.vlan_qinq) {
- odp_packet_has_vlan_qinq_set(pkt, 1);
- *vlan_type = odp_cpu_to_be_16(ODPH_ETHTYPE_VLAN_OUTER);
- vlan_hdr->tci = odp_cpu_to_be_16(0);
- vlan_type = (uint16_t *)(void *)&vlan_hdr->type;
- vlan_hdr++;
- }
- if (pkt_info.vlan) {
- /* Default vlan header */
- odp_packet_has_vlan_set(pkt, 1);
- *vlan_type = odp_cpu_to_be_16(ODPH_ETHTYPE_VLAN);
- vlan_hdr->tci = odp_cpu_to_be_16(0);
- vlan_hdr->type = odp_cpu_to_be_16(eth_type);
- } else {
- ethhdr->type = odp_cpu_to_be_16(eth_type);
- }
-
- l3_offset = l2_hdr_len;
- odp_packet_l3_offset_set(pkt, l3_offset);
-
- if (!pkt_info.ipv6) {
- /* ipv4 */
- ip = (odph_ipv4hdr_t *)(buf + l3_offset);
-
- parse_ipv4_string(CLS_DEFAULT_DADDR, &addr, &mask);
- ip->dst_addr = odp_cpu_to_be_32(addr);
-
- parse_ipv4_string(CLS_DEFAULT_SADDR, &addr, &mask);
- ip->src_addr = odp_cpu_to_be_32(addr);
- ip->ver_ihl = ODPH_IPV4 << 4 | ODPH_IPV4HDR_IHL_MIN;
- ip->id = odp_cpu_to_be_16(seqno);
- odph_ipv4_csum_update(pkt);
- ip->proto = next_hdr;
- ip->tot_len = odp_cpu_to_be_16(l3_len);
- ip->ttl = DEFAULT_TTL;
- odp_packet_has_ipv4_set(pkt, 1);
- } else {
- /* ipv6 */
- odp_packet_has_ipv6_set(pkt, 1);
- ipv6 = (odph_ipv6hdr_t *)odp_packet_l3_ptr(pkt, NULL);
- version = ODPH_IPV6 << ODPH_IPV6HDR_VERSION_SHIFT;
- tc = DEFAULT_TOS << ODPH_IPV6HDR_TC_SHIFT;
- flow = seqno << ODPH_IPV6HDR_FLOW_LABEL_SHIFT;
- ver_tc_flow = version | tc | flow;
-
- ipv6->ver_tc_flow = odp_cpu_to_be_32(ver_tc_flow);
- ipv6->payload_len = odp_cpu_to_be_16(l4_len);
- ipv6->next_hdr = next_hdr;
- ipv6->hop_limit = DEFAULT_TTL;
- memcpy(ipv6->src_addr, IPV6_SRC_ADDR, ODPH_IPV6ADDR_LEN);
- memcpy(ipv6->dst_addr, IPV6_DST_ADDR, ODPH_IPV6ADDR_LEN);
- }
-
- l4_offset = l3_offset + l3_hdr_len;
- odp_packet_l4_offset_set(pkt, l4_offset);
- tcp = (odph_tcphdr_t *)(buf + l4_offset);
- udp = (odph_udphdr_t *)(buf + l4_offset);
-
- /* udp */
- if (pkt_info.udp) {
- udp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT);
- udp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT);
- udp->length = odp_cpu_to_be_16(payload_len + ODPH_UDPHDR_LEN);
- udp->chksum = 0;
- odp_packet_has_udp_set(pkt, 1);
- if (odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_GENERATE, NULL) != 0) {
- LOG_ERR("odph_udp_tcp_chksum failed\n");
- return ODP_PACKET_INVALID;
- }
- } else {
- tcp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT);
- tcp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT);
- tcp->hl = ODPH_TCPHDR_LEN / 4;
- tcp->cksm = 0;
- odp_packet_has_tcp_set(pkt, 1);
- if (odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_GENERATE, NULL) != 0) {
- LOG_ERR("odph_udp_tcp_chksum failed\n");
- return ODP_PACKET_INVALID;
- }
-
- }
-
- /* set pkt sequence number */
- cls_pkt_set_seq(pkt);
-
- return pkt;
-}
-
-odp_cls_pmr_term_t find_first_supported_l3_pmr(void)
-{
- odp_cls_pmr_term_t term = ODP_PMR_TCP_DPORT;
- odp_cls_capability_t capability;
-
- odp_cls_capability(&capability);
-
- /* choose supported PMR */
- if (capability.supported_terms.bit.udp_sport)
- term = ODP_PMR_UDP_SPORT;
- else if (capability.supported_terms.bit.udp_dport)
- term = ODP_PMR_UDP_DPORT;
- else if (capability.supported_terms.bit.tcp_sport)
- term = ODP_PMR_TCP_SPORT;
- else if (capability.supported_terms.bit.tcp_dport)
- term = ODP_PMR_TCP_DPORT;
- else
- CU_FAIL("Implementations doesn't support any TCP/UDP PMR");
-
- return term;
-}
-
-int set_first_supported_pmr_port(odp_packet_t pkt, uint16_t port)
-{
- odph_udphdr_t *udp;
- odph_tcphdr_t *tcp;
- odp_cls_pmr_term_t term;
-
- udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- port = odp_cpu_to_be_16(port);
- term = find_first_supported_l3_pmr();
- switch (term) {
- case ODP_PMR_UDP_SPORT:
- udp->src_port = port;
- break;
- case ODP_PMR_UDP_DPORT:
- udp->dst_port = port;
- break;
- case ODP_PMR_TCP_DPORT:
- tcp->dst_port = port;
- break;
- case ODP_PMR_TCP_SPORT:
- tcp->src_port = port;
- break;
- default:
- CU_FAIL("Unsupported L3 term");
- return -1;
- }
-
- return 0;
-}
deleted file mode 100644
@@ -1,1963 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include "config.h"
-
-#include "odp_classification_testsuites.h"
-#include "classification.h"
-#include <odp_cunit_common.h>
-
-static odp_pool_t pkt_pool;
-/** sequence number of IP packets */
-odp_atomic_u32_t seq;
-
-static cls_packet_info_t default_pkt_info;
-
-int classification_suite_pmr_init(void)
-{
- pkt_pool = pool_create("classification_pmr_pool");
- if (ODP_POOL_INVALID == pkt_pool) {
- fprintf(stderr, "Packet pool creation failed.\n");
- return -1;
- }
-
- memset(&default_pkt_info, 0, sizeof(cls_packet_info_t));
- default_pkt_info.pool = pkt_pool;
- default_pkt_info.seq = &seq;
-
- odp_atomic_init_u32(&seq, 0);
-
- return 0;
-}
-
-static int start_pktio(odp_pktio_t pktio)
-{
- if (odp_pktio_start(pktio)) {
- fprintf(stderr, "unable to start loop\n");
- return -1;
- }
-
- return 0;
-}
-
-void configure_default_cos(odp_pktio_t pktio, odp_cos_t *cos,
- odp_queue_t *queue, odp_pool_t *pool)
-{
- odp_cls_cos_param_t cls_param;
- odp_pool_t default_pool;
- odp_cos_t default_cos;
- odp_queue_t default_queue;
- int retval;
- char cosname[ODP_COS_NAME_LEN];
-
- default_pool = pool_create("DefaultPool");
- CU_ASSERT(default_pool != ODP_POOL_INVALID);
-
- default_queue = queue_create("DefaultQueue", true);
- CU_ASSERT(default_queue != ODP_QUEUE_INVALID);
-
- sprintf(cosname, "DefaultCos");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = default_pool;
- cls_param.queue = default_queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- default_cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT(default_cos != ODP_COS_INVALID);
-
- retval = odp_pktio_default_cos_set(pktio, default_cos);
- CU_ASSERT(retval == 0);
-
- *cos = default_cos;
- *queue = default_queue;
- *pool = default_pool;
-}
-
-int classification_suite_pmr_term(void)
-{
- int retcode = 0;
-
- if (0 != odp_pool_destroy(pkt_pool)) {
- fprintf(stderr, "pkt_pool destroy failed.\n");
- retcode = -1;
- }
-
- return retcode;
-}
-
-static void classification_test_pktin_classifier_flag(void)
-{
- odp_packet_t pkt;
- odph_tcphdr_t *tcp;
- uint32_t seqno;
- uint16_t val;
- uint16_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pool_t pool;
- odp_pool_t pool_recv;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
-
- val = CLS_DEFAULT_DPORT;
- mask = 0xffff;
- seqno = 0;
-
- /* classifier is disabled in pktin queue configuration */
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, false);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("tcp_dport1", true);
- CU_ASSERT(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("tcp_dport1");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "tcp_dport");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_TCP_DPORT;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- tcp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT);
-
- enqueue_pktio_interface(pkt, pktio);
-
- /* since classifier flag is disabled in pktin queue configuration
- packet will not be delivered in classifier queues */
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- pool_recv = odp_packet_pool(pkt);
- /* since classifier is disabled packet should not be received in
- pool and queue configured with classifier */
- CU_ASSERT(pool != pool_recv);
- CU_ASSERT(retqueue != queue);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
-
- odp_packet_free(pkt);
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- stop_pktio(pktio);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pool_destroy(pool);
- odp_pool_destroy(default_pool);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_tcp_dport(void)
-{
- odp_packet_t pkt;
- odph_tcphdr_t *tcp;
- uint32_t seqno;
- uint16_t val;
- uint16_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pool_t pool;
- odp_pool_t pool_recv;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
- val = CLS_DEFAULT_DPORT;
- mask = 0xffff;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("tcp_dport1", true);
- CU_ASSERT(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("tcp_dport1");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "tcp_dport");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_TCP_DPORT;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- tcp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- pool_recv = odp_packet_pool(pkt);
- CU_ASSERT(pool == pool_recv);
- CU_ASSERT(retqueue == queue);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
-
- odp_packet_free(pkt);
-
- /* Other packets are delivered to default queue */
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- tcp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT + 1);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == default_queue);
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == default_pool);
-
- odp_packet_free(pkt);
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- stop_pktio(pktio);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pool_destroy(pool);
- odp_pool_destroy(default_pool);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_tcp_sport(void)
-{
- odp_packet_t pkt;
- odph_tcphdr_t *tcp;
- uint32_t seqno;
- uint16_t val;
- uint16_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
-
- val = CLS_DEFAULT_SPORT;
- mask = 0xffff;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("tcp_sport", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("tcp_sport");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "tcp_sport");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_TCP_SPORT;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- tcp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == queue);
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool);
- odp_packet_free(pkt);
-
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- tcp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT + 1);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == default_queue);
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == default_pool);
-
- odp_packet_free(pkt);
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_udp_dport(void)
-{
- odp_packet_t pkt;
- odph_udphdr_t *udp;
- uint32_t seqno;
- uint16_t val;
- uint16_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_pool_t pool;
- odp_pool_t recvpool;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_pmr_param_t pmr_param;
- odp_cls_cos_param_t cls_param;
- odph_ethhdr_t *eth;
- cls_packet_info_t pkt_info;
-
- val = CLS_DEFAULT_DPORT;
- mask = 0xffff;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("udp_dport", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("udp_dport");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "udp_dport");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_UDP_DPORT;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- udp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == queue);
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool);
- odp_packet_free(pkt);
-
- /* Other packets received in default queue */
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- udp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT + 1);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == default_queue);
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == default_pool);
-
- odp_packet_free(pkt);
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- stop_pktio(pktio);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_udp_sport(void)
-{
- odp_packet_t pkt;
- odph_udphdr_t *udp;
- uint32_t seqno;
- uint16_t val;
- uint16_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_pmr_param_t pmr_param;
- odp_cls_cos_param_t cls_param;
- odph_ethhdr_t *eth;
- cls_packet_info_t pkt_info;
-
- val = CLS_DEFAULT_SPORT;
- mask = 0xffff;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("udp_sport", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("udp_sport");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "udp_sport");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_UDP_SPORT;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- udp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == queue);
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool);
- odp_packet_free(pkt);
-
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
- udp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT + 1);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == default_queue);
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == default_pool);
- odp_packet_free(pkt);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_ipproto(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- uint8_t val;
- uint8_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
- cls_packet_info_t pkt_info;
-
- val = ODPH_IPPROTO_UDP;
- mask = 0xff;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("ipproto", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("ipproto");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "ipproto");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_IPPROTO;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool);
- CU_ASSERT(retqueue == queue);
- odp_packet_free(pkt);
-
- /* Other packets delivered to default queue */
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == default_pool);
- CU_ASSERT(retqueue == default_queue);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- odp_packet_free(pkt);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_dmac(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- uint64_t val;
- uint64_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
- cls_packet_info_t pkt_info;
-
- val = CLS_DEFAULT_DMAC; /* 48 bit Ethernet Mac address */
- mask = 0xffffffffffff;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("dmac", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("dmac");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "dmac");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_DMAC;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = ODPH_ETHADDR_LEN;
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool);
- CU_ASSERT(retqueue == queue);
- odp_packet_free(pkt);
-
- /* Other packets delivered to default queue */
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- memset(eth->dst.addr, 0, ODPH_ETHADDR_LEN);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == default_pool);
- CU_ASSERT(retqueue == default_queue);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- odp_packet_free(pkt);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_packet_len(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- uint16_t val;
- uint16_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
- cls_packet_info_t pkt_info;
-
- val = 1024;
- /*Mask value will match any packet of length 1000 - 1099*/
- mask = 0xff00;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("packet_len", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("packet_len");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "packet_len");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_LEN;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- /* create packet of payload length 1024 */
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt_info.len = 1024;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool);
- CU_ASSERT(retqueue == queue);
- odp_packet_free(pkt);
-
- /* Other packets delivered to default queue */
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == default_pool);
- CU_ASSERT(retqueue == default_queue);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- odp_packet_free(pkt);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_vlan_id_0(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- uint16_t val;
- uint16_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
- odph_vlanhdr_t *vlan_0;
- cls_packet_info_t pkt_info;
-
- val = 1024;
- mask = 0xff00;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("vlan_id_0", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("vlan_id_0");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "vlan_id_0");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_VLAN_ID_0;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- /* create packet of payload length 1024 */
- pkt_info = default_pkt_info;
- pkt_info.vlan = true;
- pkt_info.vlan_qinq = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
- vlan_0 = (odph_vlanhdr_t *)(eth + 1);
- vlan_0->tci = odp_cpu_to_be_16(1024);
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool);
- CU_ASSERT(retqueue == queue);
- odp_packet_free(pkt);
-
- /* Other packets delivered to default queue */
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == default_pool);
- CU_ASSERT(retqueue == default_queue);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- odp_packet_free(pkt);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_vlan_id_x(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- uint16_t val;
- uint16_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
- odph_vlanhdr_t *vlan_x;
- cls_packet_info_t pkt_info;
-
- val = 1024;
- mask = 0xff00;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("vlan_id_x", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("vlan_id_x");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "vlan_id_x");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_VLAN_ID_X;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- /* create packet of payload length 1024 */
- pkt_info = default_pkt_info;
- pkt_info.vlan = true;
- pkt_info.vlan_qinq = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
- vlan_x = (odph_vlanhdr_t *)(eth + 1);
- vlan_x++;
- vlan_x->tci = odp_cpu_to_be_16(1024);
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool);
- CU_ASSERT(retqueue == queue);
- odp_packet_free(pkt);
-
- /* Other packets delivered to default queue */
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == default_pool);
- CU_ASSERT(retqueue == default_queue);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- odp_packet_free(pkt);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_eth_type_0(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- uint16_t val;
- uint16_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
- cls_packet_info_t pkt_info;
-
- val = 0x88A8;
- mask = 0xffff;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("eth_type_0", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("eth_type_0");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "eth_type_0");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_ETHTYPE_0;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- pkt_info = default_pkt_info;
- pkt_info.vlan = true;
- pkt_info.vlan_qinq = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool);
- CU_ASSERT(retqueue == queue);
- odp_packet_free(pkt);
-
- /* Other packets delivered to default queue */
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == default_pool);
- CU_ASSERT(retqueue == default_queue);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- odp_packet_free(pkt);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_eth_type_x(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- uint16_t val;
- uint16_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
- odph_vlanhdr_t *vlan_x;
- cls_packet_info_t pkt_info;
-
- val = 0x8100;
- mask = 0xff00;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("eth_type_x", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("eth_type_x");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "eth_type_x");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_ETHTYPE_X;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- /* create packet of payload length 1024 */
- pkt_info = default_pkt_info;
- pkt_info.vlan = true;
- pkt_info.vlan_qinq = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
- vlan_x = (odph_vlanhdr_t *)(eth + 1);
- vlan_x->tci = odp_cpu_to_be_16(1024);
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool);
- CU_ASSERT(retqueue == queue);
- odp_packet_free(pkt);
-
- /* Other packets delivered to default queue */
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == default_pool);
- CU_ASSERT(retqueue == default_queue);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- odp_packet_free(pkt);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_pool_set(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- uint8_t val;
- uint8_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_pool_t pool_new;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
- cls_packet_info_t pkt_info;
-
- val = ODPH_IPPROTO_UDP;
- mask = 0xff;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("ipproto1", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("ipproto1");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "ipproto1");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- pool_new = pool_create("ipproto2");
- CU_ASSERT_FATAL(pool_new != ODP_POOL_INVALID);
-
- /* new pool is set on CoS */
- retval = odp_cls_cos_pool_set(cos, pool_new);
- CU_ASSERT(retval == 0);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_IPPROTO;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
-
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool_new);
- CU_ASSERT(retqueue == queue);
- odp_packet_free(pkt);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_pool_destroy(pool_new);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_queue_set(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- uint8_t val;
- uint8_t mask;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_cos_t default_cos;
- odp_pool_t default_pool;
- odp_pool_t pool;
- odp_queue_t queue_new;
- odp_pool_t recvpool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- char cosname[ODP_COS_NAME_LEN];
- odp_cls_cos_param_t cls_param;
- odp_pmr_param_t pmr_param;
- odph_ethhdr_t *eth;
- cls_packet_info_t pkt_info;
-
- val = ODPH_IPPROTO_UDP;
- mask = 0xff;
- seqno = 0;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("ipproto1", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("ipproto1");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "ipproto1");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- queue_new = queue_create("ipproto2", true);
- CU_ASSERT_FATAL(queue_new != ODP_QUEUE_INVALID);
-
- /* new queue is set on CoS */
- retval = odp_cos_queue_set(cos, queue_new);
- CU_ASSERT(retval == 0);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_IPPROTO;
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT(pmr != ODP_PMR_INVAL);
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- recvpool = odp_packet_pool(pkt);
- CU_ASSERT(recvpool == pool);
- CU_ASSERT(retqueue == queue_new);
- odp_packet_free(pkt);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue_new);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_daddr(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_pool_t pool;
- odp_pool_t default_pool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- odp_cos_t default_cos;
- uint32_t addr;
- uint32_t mask;
- char cosname[ODP_QUEUE_NAME_LEN];
- odp_pmr_param_t pmr_param;
- odp_cls_cos_param_t cls_param;
- odph_ipv4hdr_t *ip;
- const char *dst_addr = "10.0.0.99/32";
- odph_ethhdr_t *eth;
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("daddr", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("daddr");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "daddr");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- parse_ipv4_string(dst_addr, &addr, &mask);
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_DIP_ADDR;
- pmr_param.match.value = &addr;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(addr);
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT_FATAL(pmr != ODP_PMR_INVAL);
-
- /* packet with dst ip address matching PMR rule to be
- received in the CoS queue*/
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
- ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
- ip->dst_addr = odp_cpu_to_be_32(addr);
- odph_ipv4_csum_update(pkt);
-
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == queue);
- odp_packet_free(pkt);
-
- /* Other packets delivered to default queue */
- pkt = create_packet(default_pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == default_queue);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- odp_packet_free(pkt);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_ipv6daddr(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_pool_t pool;
- odp_pool_t default_pool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- odp_cos_t default_cos;
- char cosname[ODP_QUEUE_NAME_LEN];
- odp_pmr_param_t pmr_param;
- odp_cls_cos_param_t cls_param;
- odph_ipv6hdr_t *ip;
- odph_ethhdr_t *eth;
- cls_packet_info_t pkt_info;
-
- uint8_t IPV6_DST_ADDR[ODPH_IPV6ADDR_LEN] = {
- /* I.e. ::ffff:10.1.1.100 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 10, 1, 1, 100
- };
- uint8_t ipv6_mask[ODPH_IPV6ADDR_LEN] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
- };
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("daddr", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("daddr");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "daddr");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_DIP6_ADDR;
- pmr_param.match.value = IPV6_DST_ADDR;
- pmr_param.match.mask = ipv6_mask;
- pmr_param.val_sz = ODPH_IPV6ADDR_LEN;
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT_FATAL(pmr != ODP_PMR_INVAL);
-
- /* packet with dst ip address matching PMR rule to be
- received in the CoS queue*/
- pkt_info = default_pkt_info;
- pkt_info.ipv6 = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
- ip = (odph_ipv6hdr_t *)odp_packet_l3_ptr(pkt, NULL);
- memcpy(ip->dst_addr, IPV6_DST_ADDR, ODPH_IPV6ADDR_LEN);
-
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == queue);
- odp_packet_free(pkt);
-
- /* Other packets delivered to default queue */
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == default_queue);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- odp_packet_free(pkt);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-static void classification_test_pmr_term_ipv6saddr(void)
-{
- odp_packet_t pkt;
- uint32_t seqno;
- int retval;
- odp_pktio_t pktio;
- odp_queue_t queue;
- odp_queue_t retqueue;
- odp_queue_t default_queue;
- odp_pool_t pool;
- odp_pool_t default_pool;
- odp_pmr_t pmr;
- odp_cos_t cos;
- odp_cos_t default_cos;
- char cosname[ODP_QUEUE_NAME_LEN];
- odp_pmr_param_t pmr_param;
- odp_cls_cos_param_t cls_param;
- odph_ipv6hdr_t *ip;
- odph_ethhdr_t *eth;
- cls_packet_info_t pkt_info;
- uint8_t IPV6_SRC_ADDR[ODPH_IPV6ADDR_LEN] = {
- /* I.e. ::ffff:10.0.0.100 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 10, 1, 1, 1
- };
- uint8_t ipv6_mask[ODPH_IPV6ADDR_LEN] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
- };
-
- pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
- retval = start_pktio(pktio);
- CU_ASSERT(retval == 0);
-
- configure_default_cos(pktio, &default_cos,
- &default_queue, &default_pool);
-
- queue = queue_create("saddr", true);
- CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
-
- pool = pool_create("saddr");
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
- sprintf(cosname, "saddr");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue;
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos != ODP_COS_INVALID);
-
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_SIP6_ADDR;
- pmr_param.match.value = IPV6_SRC_ADDR;
- pmr_param.match.mask = ipv6_mask;
- pmr_param.val_sz = ODPH_IPV6ADDR_LEN;
-
- pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos);
- CU_ASSERT_FATAL(pmr != ODP_PMR_INVAL);
-
- /* packet with dst ip address matching PMR rule to be
- received in the CoS queue*/
- pkt_info = default_pkt_info;
- pkt_info.ipv6 = true;
-
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
- ip = (odph_ipv6hdr_t *)odp_packet_l3_ptr(pkt, NULL);
- memcpy(ip->src_addr, IPV6_SRC_ADDR, ODPH_IPV6ADDR_LEN);
-
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == queue);
- odp_packet_free(pkt);
-
- /* Other packets delivered to default queue */
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
- odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
-
- enqueue_pktio_interface(pkt, pktio);
-
- pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- CU_ASSERT(retqueue == default_queue);
-
- odp_cos_destroy(cos);
- odp_cos_destroy(default_cos);
- odp_cls_pmr_destroy(pmr);
- odp_packet_free(pkt);
- stop_pktio(pktio);
- odp_pool_destroy(default_pool);
- odp_pool_destroy(pool);
- odp_queue_destroy(queue);
- odp_queue_destroy(default_queue);
- odp_pktio_close(pktio);
-}
-
-odp_testinfo_t classification_suite_pmr[] = {
- ODP_TEST_INFO(classification_test_pmr_term_tcp_dport),
- ODP_TEST_INFO(classification_test_pmr_term_tcp_sport),
- ODP_TEST_INFO(classification_test_pmr_term_udp_dport),
- ODP_TEST_INFO(classification_test_pmr_term_udp_sport),
- ODP_TEST_INFO(classification_test_pmr_term_ipproto),
- ODP_TEST_INFO(classification_test_pmr_term_dmac),
- ODP_TEST_INFO(classification_test_pmr_pool_set),
- ODP_TEST_INFO(classification_test_pmr_queue_set),
- ODP_TEST_INFO(classification_test_pmr_term_daddr),
- ODP_TEST_INFO(classification_test_pmr_term_ipv6saddr),
- ODP_TEST_INFO(classification_test_pmr_term_ipv6daddr),
- ODP_TEST_INFO(classification_test_pmr_term_packet_len),
- ODP_TEST_INFO(classification_test_pmr_term_vlan_id_0),
- ODP_TEST_INFO(classification_test_pmr_term_vlan_id_x),
- ODP_TEST_INFO(classification_test_pmr_term_eth_type_0),
- ODP_TEST_INFO(classification_test_pmr_term_eth_type_x),
- ODP_TEST_INFO(classification_test_pktin_classifier_flag),
- ODP_TEST_INFO_NULL,
-};
deleted file mode 100644
@@ -1,724 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include "config.h"
-
-#include "odp_classification_testsuites.h"
-#include "classification.h"
-#include <odp_cunit_common.h>
-
-static odp_cos_t cos_list[CLS_ENTRIES];
-static odp_pmr_t pmr_list[CLS_ENTRIES];
-static odp_queue_t queue_list[CLS_ENTRIES];
-static odp_pool_t pool_list[CLS_ENTRIES];
-
-static odp_pool_t pool_default;
-static odp_pktio_t pktio_loop;
-
-/** sequence number of IP packets */
-odp_atomic_u32_t seq;
-
-/* default packet info */
-static cls_packet_info_t default_pkt_info;
-
-int classification_suite_init(void)
-{
- int i;
- int ret;
- odp_pktio_param_t pktio_param;
- odp_pktin_queue_param_t pktin_param;
-
- pool_default = pool_create("classification_pool");
- if (ODP_POOL_INVALID == pool_default) {
- fprintf(stderr, "Packet pool creation failed.\n");
- return -1;
- }
-
- odp_pktio_param_init(&pktio_param);
- pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
-
- pktio_loop = odp_pktio_open("loop", pool_default, &pktio_param);
- if (pktio_loop == ODP_PKTIO_INVALID) {
- ret = odp_pool_destroy(pool_default);
- if (ret)
- fprintf(stderr, "unable to destroy pool.\n");
- return -1;
- }
-
- memset(&default_pkt_info, 0, sizeof(cls_packet_info_t));
- default_pkt_info.pool = pool_default;
- default_pkt_info.seq = &seq;
-
- odp_pktin_queue_param_init(&pktin_param);
- pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;
- pktin_param.classifier_enable = true;
- pktin_param.hash_enable = false;
-
- if (odp_pktin_queue_config(pktio_loop, &pktin_param)) {
- fprintf(stderr, "pktin queue config failed.\n");
- return -1;
- }
-
- if (odp_pktout_queue_config(pktio_loop, NULL)) {
- fprintf(stderr, "pktout queue config failed.\n");
- return -1;
- }
-
- for (i = 0; i < CLS_ENTRIES; i++)
- cos_list[i] = ODP_COS_INVALID;
-
- for (i = 0; i < CLS_ENTRIES; i++)
- pmr_list[i] = ODP_PMR_INVAL;
-
- for (i = 0; i < CLS_ENTRIES; i++)
- queue_list[i] = ODP_QUEUE_INVALID;
-
- for (i = 0; i < CLS_ENTRIES; i++)
- pool_list[i] = ODP_POOL_INVALID;
-
- odp_atomic_init_u32(&seq, 0);
-
- ret = odp_pktio_start(pktio_loop);
- if (ret) {
- fprintf(stderr, "unable to start loop\n");
- return -1;
- }
-
- return 0;
-}
-
-int classification_suite_term(void)
-{
- int i;
- int retcode = 0;
-
- if (0 > stop_pktio(pktio_loop)) {
- fprintf(stderr, "stop pktio failed.\n");
- retcode = -1;
- }
-
- if (0 > odp_pktio_close(pktio_loop)) {
- fprintf(stderr, "pktio close failed.\n");
- retcode = -1;
- }
-
- if (0 != odp_pool_destroy(pool_default)) {
- fprintf(stderr, "pool_default destroy failed.\n");
- retcode = -1;
- }
-
- for (i = 0; i < CLS_ENTRIES; i++)
- odp_cos_destroy(cos_list[i]);
-
- for (i = 0; i < CLS_ENTRIES; i++)
- odp_cls_pmr_destroy(pmr_list[i]);
-
- for (i = 0; i < CLS_ENTRIES; i++)
- odp_queue_destroy(queue_list[i]);
-
- for (i = 0; i < CLS_ENTRIES; i++)
- odp_pool_destroy(pool_list[i]);
-
- return retcode;
-}
-
-void configure_cls_pmr_chain(void)
-{
- /* PKTIO --> PMR_SRC(SRC IP ADDR) --> PMR_DST (TCP SPORT) */
-
- /* Packet matching only the SRC IP ADDR should be delivered
- in queue[CLS_PMR_CHAIN_SRC] and a packet matching both SRC IP ADDR and
- TCP SPORT should be delivered to queue[CLS_PMR_CHAIN_DST] */
-
- uint16_t val;
- uint16_t maskport;
- char cosname[ODP_QUEUE_NAME_LEN];
- odp_queue_param_t qparam;
- odp_cls_cos_param_t cls_param;
- char queuename[ODP_QUEUE_NAME_LEN];
- char poolname[ODP_POOL_NAME_LEN];
- uint32_t addr;
- uint32_t mask;
- odp_pmr_param_t pmr_param;
- odp_queue_capability_t queue_capa;
-
- CU_ASSERT_FATAL(odp_queue_capability(&queue_capa) == 0);
-
- odp_queue_param_init(&qparam);
- qparam.type = ODP_QUEUE_TYPE_SCHED;
- qparam.sched.prio = ODP_SCHED_PRIO_NORMAL;
- qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL;
- qparam.sched.group = ODP_SCHED_GROUP_ALL;
- qparam.sched.lock_count = queue_capa.max_ordered_locks;
- sprintf(queuename, "%s", "SrcQueue");
-
- queue_list[CLS_PMR_CHAIN_SRC] = odp_queue_create(queuename, &qparam);
-
- CU_ASSERT_FATAL(queue_list[CLS_PMR_CHAIN_SRC] != ODP_QUEUE_INVALID);
-
- sprintf(poolname, "%s", "SrcPool");
- pool_list[CLS_PMR_CHAIN_SRC] = pool_create(poolname);
- CU_ASSERT_FATAL(pool_list[CLS_PMR_CHAIN_SRC] != ODP_POOL_INVALID);
-
- sprintf(cosname, "SrcCos");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool_list[CLS_PMR_CHAIN_SRC];
- cls_param.queue = queue_list[CLS_PMR_CHAIN_SRC];
- cls_param.drop_policy = ODP_COS_DROP_POOL;
-
- cos_list[CLS_PMR_CHAIN_SRC] = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos_list[CLS_PMR_CHAIN_SRC] != ODP_COS_INVALID);
-
- odp_queue_param_init(&qparam);
- qparam.type = ODP_QUEUE_TYPE_SCHED;
- qparam.sched.prio = ODP_SCHED_PRIO_NORMAL;
- qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL;
- qparam.sched.group = ODP_SCHED_GROUP_ALL;
- sprintf(queuename, "%s", "DstQueue");
-
- queue_list[CLS_PMR_CHAIN_DST] = odp_queue_create(queuename, &qparam);
- CU_ASSERT_FATAL(queue_list[CLS_PMR_CHAIN_DST] != ODP_QUEUE_INVALID);
-
- sprintf(poolname, "%s", "DstPool");
- pool_list[CLS_PMR_CHAIN_DST] = pool_create(poolname);
- CU_ASSERT_FATAL(pool_list[CLS_PMR_CHAIN_DST] != ODP_POOL_INVALID);
-
- sprintf(cosname, "DstCos");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool_list[CLS_PMR_CHAIN_DST];
- cls_param.queue = queue_list[CLS_PMR_CHAIN_DST];
- cls_param.drop_policy = ODP_COS_DROP_POOL;
- cos_list[CLS_PMR_CHAIN_DST] = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos_list[CLS_PMR_CHAIN_DST] != ODP_COS_INVALID);
-
- parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = ODP_PMR_SIP_ADDR;
- pmr_param.match.value = &addr;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(addr);
- pmr_list[CLS_PMR_CHAIN_SRC] =
- odp_cls_pmr_create(&pmr_param, 1, cos_list[CLS_DEFAULT],
- cos_list[CLS_PMR_CHAIN_SRC]);
- CU_ASSERT_FATAL(pmr_list[CLS_PMR_CHAIN_SRC] != ODP_PMR_INVAL);
-
- val = CLS_PMR_CHAIN_PORT;
- maskport = 0xffff;
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = find_first_supported_l3_pmr();
- pmr_param.match.value = &val;
- pmr_param.match.mask = &maskport;
- pmr_param.val_sz = sizeof(val);
- pmr_list[CLS_PMR_CHAIN_DST] =
- odp_cls_pmr_create(&pmr_param, 1, cos_list[CLS_PMR_CHAIN_SRC],
- cos_list[CLS_PMR_CHAIN_DST]);
- CU_ASSERT_FATAL(pmr_list[CLS_PMR_CHAIN_DST] != ODP_PMR_INVAL);
-}
-
-void test_cls_pmr_chain(void)
-{
- odp_packet_t pkt;
- odph_ipv4hdr_t *ip;
- odp_queue_t queue;
- odp_pool_t pool;
- uint32_t addr = 0;
- uint32_t mask;
- uint32_t seqno = 0;
- cls_packet_info_t pkt_info;
-
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
-
- ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
- parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
- ip->src_addr = odp_cpu_to_be_32(addr);
- odph_ipv4_csum_update(pkt);
-
- set_first_supported_pmr_port(pkt, CLS_PMR_CHAIN_PORT);
-
- enqueue_pktio_interface(pkt, pktio_loop);
-
- pkt = receive_packet(&queue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(queue == queue_list[CLS_PMR_CHAIN_DST]);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- pool = odp_packet_pool(pkt);
- CU_ASSERT(pool == pool_list[CLS_PMR_CHAIN_DST]);
- odp_packet_free(pkt);
-
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
-
- ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
- parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
- ip->src_addr = odp_cpu_to_be_32(addr);
- odph_ipv4_csum_update(pkt);
-
- enqueue_pktio_interface(pkt, pktio_loop);
- pkt = receive_packet(&queue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(queue == queue_list[CLS_PMR_CHAIN_SRC]);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- pool = odp_packet_pool(pkt);
- CU_ASSERT(pool == pool_list[CLS_PMR_CHAIN_SRC]);
- odp_packet_free(pkt);
-}
-
-void configure_pktio_default_cos(void)
-{
- int retval;
- odp_queue_param_t qparam;
- odp_cls_cos_param_t cls_param;
- char cosname[ODP_COS_NAME_LEN];
- char queuename[ODP_QUEUE_NAME_LEN];
- char poolname[ODP_POOL_NAME_LEN];
-
- 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;
- sprintf(queuename, "%s", "DefaultQueue");
- queue_list[CLS_DEFAULT] = odp_queue_create(queuename, &qparam);
- CU_ASSERT_FATAL(queue_list[CLS_DEFAULT] != ODP_QUEUE_INVALID);
-
- sprintf(poolname, "DefaultPool");
- pool_list[CLS_DEFAULT] = pool_create(poolname);
- CU_ASSERT_FATAL(pool_list[CLS_DEFAULT] != ODP_POOL_INVALID);
-
- sprintf(cosname, "DefaultCoS");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool_list[CLS_DEFAULT];
- cls_param.queue = queue_list[CLS_DEFAULT];
- cls_param.drop_policy = ODP_COS_DROP_POOL;
- cos_list[CLS_DEFAULT] = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos_list[CLS_DEFAULT] != ODP_COS_INVALID);
-
- retval = odp_pktio_default_cos_set(pktio_loop, cos_list[CLS_DEFAULT]);
- CU_ASSERT(retval == 0);
-}
-
-void test_pktio_default_cos(void)
-{
- odp_packet_t pkt;
- odp_queue_t queue;
- uint32_t seqno = 0;
- odp_pool_t pool;
- cls_packet_info_t pkt_info;
-
- /* create a default packet */
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
-
- enqueue_pktio_interface(pkt, pktio_loop);
-
- pkt = receive_packet(&queue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- /* Default packet should be received in default queue */
- CU_ASSERT(queue == queue_list[CLS_DEFAULT]);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- pool = odp_packet_pool(pkt);
- CU_ASSERT(pool == pool_list[CLS_DEFAULT]);
-
- odp_packet_free(pkt);
-}
-
-void configure_pktio_error_cos(void)
-{
- int retval;
- odp_queue_param_t qparam;
- odp_cls_cos_param_t cls_param;
- char queuename[ODP_QUEUE_NAME_LEN];
- char cosname[ODP_COS_NAME_LEN];
- char poolname[ODP_POOL_NAME_LEN];
-
- odp_queue_param_init(&qparam);
- qparam.type = ODP_QUEUE_TYPE_SCHED;
- qparam.sched.prio = ODP_SCHED_PRIO_LOWEST;
- qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL;
- qparam.sched.group = ODP_SCHED_GROUP_ALL;
- sprintf(queuename, "%s", "ErrorCos");
-
- queue_list[CLS_ERROR] = odp_queue_create(queuename, &qparam);
- CU_ASSERT_FATAL(queue_list[CLS_ERROR] != ODP_QUEUE_INVALID);
-
- sprintf(poolname, "ErrorPool");
- pool_list[CLS_ERROR] = pool_create(poolname);
- CU_ASSERT_FATAL(pool_list[CLS_ERROR] != ODP_POOL_INVALID);
-
- sprintf(cosname, "%s", "ErrorCos");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool_list[CLS_ERROR];
- cls_param.queue = queue_list[CLS_ERROR];
- cls_param.drop_policy = ODP_COS_DROP_POOL;
- cos_list[CLS_ERROR] = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos_list[CLS_ERROR] != ODP_COS_INVALID);
-
- retval = odp_pktio_error_cos_set(pktio_loop, cos_list[CLS_ERROR]);
- CU_ASSERT(retval == 0);
-}
-
-void test_pktio_error_cos(void)
-{
- odp_queue_t queue;
- odp_packet_t pkt;
- odp_pool_t pool;
- cls_packet_info_t pkt_info;
-
- /*Create an error packet */
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- odph_ipv4hdr_t *ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
-
- /* Incorrect IpV4 version */
- ip->ver_ihl = 8 << 4 | ODPH_IPV4HDR_IHL_MIN;
- ip->chksum = 0;
- enqueue_pktio_interface(pkt, pktio_loop);
-
- pkt = receive_packet(&queue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- /* Error packet should be received in error queue */
- CU_ASSERT(queue == queue_list[CLS_ERROR]);
- pool = odp_packet_pool(pkt);
- CU_ASSERT(pool == pool_list[CLS_ERROR]);
- odp_packet_free(pkt);
-}
-
-static void classification_test_pktio_set_skip(void)
-{
- int retval;
- size_t offset = 5;
-
- retval = odp_pktio_skip_set(pktio_loop, offset);
- CU_ASSERT(retval == 0);
-
- retval = odp_pktio_skip_set(ODP_PKTIO_INVALID, offset);
- CU_ASSERT(retval < 0);
-
- /* reset skip value to zero as validation suite expects
- offset to be zero*/
-
- retval = odp_pktio_skip_set(pktio_loop, 0);
- CU_ASSERT(retval == 0);
-}
-
-static void classification_test_pktio_set_headroom(void)
-{
- size_t headroom;
- int retval;
-
- headroom = 5;
- retval = odp_pktio_headroom_set(pktio_loop, headroom);
- CU_ASSERT(retval == 0);
-
- retval = odp_pktio_headroom_set(ODP_PKTIO_INVALID, headroom);
- CU_ASSERT(retval < 0);
-}
-
-void configure_cos_with_l2_priority(void)
-{
- uint8_t num_qos = CLS_L2_QOS_MAX;
- odp_cos_t cos_tbl[CLS_L2_QOS_MAX];
- odp_queue_t queue_tbl[CLS_L2_QOS_MAX];
- odp_pool_t pool;
- uint8_t qos_tbl[CLS_L2_QOS_MAX];
- char cosname[ODP_COS_NAME_LEN];
- char queuename[ODP_QUEUE_NAME_LEN];
- char poolname[ODP_POOL_NAME_LEN];
- int retval;
- int i;
- odp_queue_param_t qparam;
- odp_cls_cos_param_t cls_param;
-
- /** Initialize scalar variable qos_tbl **/
- for (i = 0; i < CLS_L2_QOS_MAX; i++)
- qos_tbl[i] = 0;
-
- odp_queue_param_init(&qparam);
- qparam.type = ODP_QUEUE_TYPE_SCHED;
- qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL;
- qparam.sched.group = ODP_SCHED_GROUP_ALL;
- for (i = 0; i < num_qos; i++) {
- qparam.sched.prio = ODP_SCHED_PRIO_LOWEST - i;
- sprintf(queuename, "%s_%d", "L2_Queue", i);
- queue_tbl[i] = odp_queue_create(queuename, &qparam);
- CU_ASSERT_FATAL(queue_tbl[i] != ODP_QUEUE_INVALID);
- queue_list[CLS_L2_QOS_0 + i] = queue_tbl[i];
-
- sprintf(poolname, "%s_%d", "L2_Pool", i);
- pool = pool_create(poolname);
- CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
- pool_list[CLS_L2_QOS_0 + i] = pool;
-
- sprintf(cosname, "%s_%d", "L2_Cos", i);
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool;
- cls_param.queue = queue_tbl[i];
- cls_param.drop_policy = ODP_COS_DROP_POOL;
- cos_tbl[i] = odp_cls_cos_create(cosname, &cls_param);
- if (cos_tbl[i] == ODP_COS_INVALID)
- break;
-
- cos_list[CLS_L2_QOS_0 + i] = cos_tbl[i];
- qos_tbl[i] = i;
- }
- /* count 'i' is passed instead of num_qos to handle the rare scenario
- if the odp_cls_cos_create() failed in the middle*/
- retval = odp_cos_with_l2_priority(pktio_loop, i, qos_tbl, cos_tbl);
- CU_ASSERT(retval == 0);
-}
-
-void test_cos_with_l2_priority(void)
-{
- odp_packet_t pkt;
- odph_ethhdr_t *ethhdr;
- odph_vlanhdr_t *vlan;
- odp_queue_t queue;
- odp_pool_t pool;
- uint32_t seqno = 0;
- cls_packet_info_t pkt_info;
- uint8_t i;
-
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt_info.vlan = true;
-
- for (i = 0; i < CLS_L2_QOS_MAX; i++) {
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- ethhdr = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
- vlan = (odph_vlanhdr_t *)(ethhdr + 1);
- vlan->tci = odp_cpu_to_be_16(i << 13);
- enqueue_pktio_interface(pkt, pktio_loop);
- pkt = receive_packet(&queue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(queue == queue_list[CLS_L2_QOS_0 + i]);
- pool = odp_packet_pool(pkt);
- CU_ASSERT(pool == pool_list[CLS_L2_QOS_0 + i]);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- odp_packet_free(pkt);
- }
-}
-
-void configure_pmr_cos(void)
-{
- uint16_t val;
- uint16_t mask;
- odp_pmr_param_t pmr_param;
- odp_queue_param_t qparam;
- odp_cls_cos_param_t cls_param;
- char cosname[ODP_COS_NAME_LEN];
- char queuename[ODP_QUEUE_NAME_LEN];
- char poolname[ODP_POOL_NAME_LEN];
-
- odp_queue_param_init(&qparam);
- qparam.type = ODP_QUEUE_TYPE_SCHED;
- qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST;
- qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL;
- qparam.sched.group = ODP_SCHED_GROUP_ALL;
- sprintf(queuename, "%s", "PMR_CoS");
-
- queue_list[CLS_PMR] = odp_queue_create(queuename, &qparam);
- CU_ASSERT_FATAL(queue_list[CLS_PMR] != ODP_QUEUE_INVALID);
-
- sprintf(poolname, "PMR_Pool");
- pool_list[CLS_PMR] = pool_create(poolname);
- CU_ASSERT_FATAL(pool_list[CLS_PMR] != ODP_POOL_INVALID);
-
- sprintf(cosname, "PMR_CoS");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool_list[CLS_PMR];
- cls_param.queue = queue_list[CLS_PMR];
- cls_param.drop_policy = ODP_COS_DROP_POOL;
- cos_list[CLS_PMR] = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos_list[CLS_PMR] != ODP_COS_INVALID);
-
- val = CLS_PMR_PORT;
- mask = 0xffff;
- odp_cls_pmr_param_init(&pmr_param);
- pmr_param.term = find_first_supported_l3_pmr();
- pmr_param.match.value = &val;
- pmr_param.match.mask = &mask;
- pmr_param.val_sz = sizeof(val);
-
- pmr_list[CLS_PMR] = odp_cls_pmr_create(&pmr_param, 1,
- cos_list[CLS_DEFAULT],
- cos_list[CLS_PMR]);
- CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL);
-}
-
-void test_pmr_cos(void)
-{
- odp_packet_t pkt;
- odp_queue_t queue;
- odp_pool_t pool;
- uint32_t seqno = 0;
- cls_packet_info_t pkt_info;
-
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
- set_first_supported_pmr_port(pkt, CLS_PMR_PORT);
- enqueue_pktio_interface(pkt, pktio_loop);
- pkt = receive_packet(&queue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(queue == queue_list[CLS_PMR]);
- pool = odp_packet_pool(pkt);
- CU_ASSERT(pool == pool_list[CLS_PMR]);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- odp_packet_free(pkt);
-}
-
-void configure_pktio_pmr_composite(void)
-{
- odp_pmr_param_t pmr_params[2];
- uint16_t val;
- uint16_t maskport;
- int num_terms = 2; /* one pmr for each L3 and L4 */
- odp_queue_param_t qparam;
- odp_cls_cos_param_t cls_param;
- char cosname[ODP_COS_NAME_LEN];
- char queuename[ODP_QUEUE_NAME_LEN];
- char poolname[ODP_POOL_NAME_LEN];
- uint32_t addr = 0;
- uint32_t mask;
-
- odp_queue_param_init(&qparam);
- qparam.type = ODP_QUEUE_TYPE_SCHED;
- qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST;
- qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL;
- qparam.sched.group = ODP_SCHED_GROUP_ALL;
- sprintf(queuename, "%s", "cos_pmr_composite_queue");
-
- queue_list[CLS_PMR_SET] = odp_queue_create(queuename, &qparam);
- CU_ASSERT_FATAL(queue_list[CLS_PMR_SET] != ODP_QUEUE_INVALID);
-
- sprintf(poolname, "cos_pmr_composite_pool");
- pool_list[CLS_PMR_SET] = pool_create(poolname);
- CU_ASSERT_FATAL(pool_list[CLS_PMR_SET] != ODP_POOL_INVALID);
-
- sprintf(cosname, "cos_pmr_composite");
- odp_cls_cos_param_init(&cls_param);
- cls_param.pool = pool_list[CLS_PMR_SET];
- cls_param.queue = queue_list[CLS_PMR_SET];
- cls_param.drop_policy = ODP_COS_DROP_POOL;
- cos_list[CLS_PMR_SET] = odp_cls_cos_create(cosname, &cls_param);
- CU_ASSERT_FATAL(cos_list[CLS_PMR_SET] != ODP_COS_INVALID);
-
- parse_ipv4_string(CLS_PMR_SET_SADDR, &addr, &mask);
- odp_cls_pmr_param_init(&pmr_params[0]);
- pmr_params[0].term = ODP_PMR_SIP_ADDR;
- pmr_params[0].match.value = &addr;
- pmr_params[0].match.mask = &mask;
- pmr_params[0].val_sz = sizeof(addr);
-
- val = CLS_PMR_SET_PORT;
- maskport = 0xffff;
- odp_cls_pmr_param_init(&pmr_params[1]);
- pmr_params[1].term = find_first_supported_l3_pmr();
- pmr_params[1].match.value = &val;
- pmr_params[1].match.mask = &maskport;
- pmr_params[1].range_term = false;
- pmr_params[1].val_sz = sizeof(val);
-
- pmr_list[CLS_PMR_SET] = odp_cls_pmr_create(pmr_params, num_terms,
- cos_list[CLS_DEFAULT],
- cos_list[CLS_PMR_SET]);
- CU_ASSERT_FATAL(pmr_list[CLS_PMR_SET] != ODP_PMR_INVAL);
-}
-
-void test_pktio_pmr_composite_cos(void)
-{
- uint32_t addr = 0;
- uint32_t mask;
- odph_ipv4hdr_t *ip;
- odp_packet_t pkt;
- odp_pool_t pool;
- odp_queue_t queue;
- uint32_t seqno = 0;
- cls_packet_info_t pkt_info;
-
- pkt_info = default_pkt_info;
- pkt_info.udp = true;
- pkt = create_packet(pkt_info);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- seqno = cls_pkt_get_seq(pkt);
- CU_ASSERT(seqno != TEST_SEQ_INVALID);
-
- ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
- parse_ipv4_string(CLS_PMR_SET_SADDR, &addr, &mask);
- ip->src_addr = odp_cpu_to_be_32(addr);
- odph_ipv4_csum_update(pkt);
-
- set_first_supported_pmr_port(pkt, CLS_PMR_SET_PORT);
- enqueue_pktio_interface(pkt, pktio_loop);
- pkt = receive_packet(&queue, ODP_TIME_SEC_IN_NS);
- CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
- CU_ASSERT(queue == queue_list[CLS_PMR_SET]);
- pool = odp_packet_pool(pkt);
- CU_ASSERT(pool == pool_list[CLS_PMR_SET]);
- CU_ASSERT(seqno == cls_pkt_get_seq(pkt));
- odp_packet_free(pkt);
-}
-
-static void classification_test_pktio_configure(void)
-{
- /* Configure the Different CoS for the pktio interface */
- if (TEST_DEFAULT)
- configure_pktio_default_cos();
- if (TEST_ERROR)
- configure_pktio_error_cos();
- if (TEST_PMR_CHAIN)
- configure_cls_pmr_chain();
- if (TEST_L2_QOS)
- configure_cos_with_l2_priority();
- if (TEST_PMR)
- configure_pmr_cos();
- if (TEST_PMR_SET)
- configure_pktio_pmr_composite();
-}
-
-static void classification_test_pktio_test(void)
-{
- /* Test Different CoS on the pktio interface */
- if (TEST_DEFAULT)
- test_pktio_default_cos();
- if (TEST_ERROR)
- test_pktio_error_cos();
- if (TEST_PMR_CHAIN)
- test_cls_pmr_chain();
- if (TEST_L2_QOS)
- test_cos_with_l2_priority();
- if (TEST_PMR)
- test_pmr_cos();
- if (TEST_PMR_SET)
- test_pktio_pmr_composite_cos();
-}
-
-odp_testinfo_t classification_suite[] = {
- ODP_TEST_INFO(classification_test_pktio_set_skip),
- ODP_TEST_INFO(classification_test_pktio_set_headroom),
- ODP_TEST_INFO(classification_test_pktio_configure),
- ODP_TEST_INFO(classification_test_pktio_test),
- ODP_TEST_INFO_NULL,
-};
deleted file mode 100644
@@ -1,63 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef ODP_CLASSIFICATION_TESTSUITES_H_
-#define ODP_CLASSIFICATION_TESTSUITES_H_
-
-#include <odp_api.h>
-#include <odp/helper/odph_api.h>
-#include <odp_cunit_common.h>
-#include <stdbool.h>
-
-typedef struct cls_packet_info {
- odp_pool_t pool;
- bool vlan;
- bool vlan_qinq;
- odp_atomic_u32_t *seq;
- bool udp;
- bool ipv6;
- uint32_t len;
-} cls_packet_info_t;
-
-extern odp_testinfo_t classification_suite[];
-extern odp_testinfo_t classification_suite_basic[];
-extern odp_testinfo_t classification_suite_pmr[];
-
-int classification_suite_init(void);
-int classification_suite_term(void);
-
-int classification_suite_pmr_term(void);
-int classification_suite_pmr_init(void);
-
-odp_packet_t create_packet(cls_packet_info_t pkt_info);
-int cls_pkt_set_seq(odp_packet_t pkt);
-uint32_t cls_pkt_get_seq(odp_packet_t pkt);
-odp_pktio_t create_pktio(odp_queue_type_t q_type, odp_pool_t pool,
- odp_bool_t cls_enable);
-void configure_default_cos(odp_pktio_t pktio, odp_cos_t *cos,
- odp_queue_t *queue, odp_pool_t *pool);
-int parse_ipv4_string(const char *ipaddress, uint32_t *addr, uint32_t *mask);
-void enqueue_pktio_interface(odp_packet_t pkt, odp_pktio_t pktio);
-odp_packet_t receive_packet(odp_queue_t *queue, uint64_t ns);
-odp_pool_t pool_create(const char *poolname);
-odp_queue_t queue_create(const char *queuename, bool sched);
-void configure_pktio_default_cos(void);
-void test_pktio_default_cos(void);
-void configure_pktio_error_cos(void);
-void test_pktio_error_cos(void);
-void configure_cls_pmr_chain(void);
-void test_cls_pmr_chain(void);
-void configure_cos_with_l2_priority(void);
-void test_cos_with_l2_priority(void);
-void configure_pmr_cos(void);
-void test_pmr_cos(void);
-void configure_pktio_pmr_composite(void);
-void test_pktio_pmr_composite_cos(void);
-int stop_pktio(odp_pktio_t pktio);
-odp_cls_pmr_term_t find_first_supported_l3_pmr(void);
-int set_first_supported_pmr_port(odp_packet_t pkt, uint16_t port);
-
-#endif /* ODP_BUFFER_TESTSUITES_H_ */
similarity index 100%
rename from test/validation/api/cpumask/cpumask.c
rename to test/validation/api/cpumask.c
deleted file mode 100644
@@ -1 +0,0 @@
-cpumask_main
deleted file mode 100644
@@ -1,5 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = cpumask_main
-cpumask_main_SOURCES = cpumask.c
-LDADD += $(LIBCPUMASK_COMMON)
similarity index 99%
rename from test/validation/api/crypto/odp_crypto_test_inp.c
rename to test/validation/api/crypto.c
@@ -9,7 +9,7 @@
#include <odp_api.h>
#include <CUnit/Basic.h>
#include <odp_cunit_common.h>
-#include "test_vectors.h"
+#include "crypto_test_vectors.h"
#define MAX_ALG_CAPA 32
deleted file mode 100644
@@ -1 +0,0 @@
-crypto_main
deleted file mode 100644
@@ -1,7 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = crypto_main
-crypto_main_SOURCES = \
- odp_crypto_test_inp.c \
- test_vectors.h \
- test_vectors_len.h
deleted file mode 100644
@@ -1,77 +0,0 @@
-/* Copyright (c) 2014, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-#ifndef TEST_VECTORS_LEN_
-#define TEST_VECTORS_LEN_
-
-/* Maximum */
-#define MAX_KEY_LEN 64
-#define MAX_IV_LEN 16
-#define MAX_DATA_LEN 128
-#define MAX_AAD_LEN 12
-#define MAX_DIGEST_LEN 64
-
-/* TDES-CBC */
-#define TDES_CBC_KEY_LEN 24
-#define TDES_CBC_IV_LEN 8
-
-/* AES-CBC common */
-#define AES_CBC_IV_LEN 16
-
-/* AES128-CBC */
-#define AES128_CBC_KEY_LEN 16
-
-/* AES192-CBC */
-#define AES192_CBC_KEY_LEN 24
-
-/* AES256-CBC */
-#define AES256_CBC_KEY_LEN 32
-
-/* AES-CBC common */
-#define AES_CTR_IV_LEN 16
-
-/* AES128-CTR */
-#define AES128_CTR_KEY_LEN 16
-
-/* AES192-CTR */
-#define AES192_CTR_KEY_LEN 24
-
-/* AES256-CTR */
-#define AES256_CTR_KEY_LEN 32
-
-/* AES-GCM common */
-#define AES_GCM_IV_LEN 12
-#define AES_GCM_DIGEST_LEN 16
-
-/* AES128-GCM */
-#define AES128_GCM_KEY_LEN 16
-
-/* AES192-GCM */
-#define AES192_GCM_KEY_LEN 24
-
-/* AES256-GCM */
-#define AES256_GCM_KEY_LEN 32
-
-/* HMAC-MD5 */
-#define HMAC_MD5_KEY_LEN 16
-#define HMAC_MD5_96_CHECK_LEN 12
-#define HMAC_MD5_CHECK_LEN 16
-
-/* HMAC-SHA256 */
-#define HMAC_SHA256_KEY_LEN 32
-#define HMAC_SHA256_128_CHECK_LEN 16
-#define HMAC_SHA256_CHECK_LEN 32
-
-/* HMAC-SHA1 */
-#define HMAC_SHA1_KEY_LEN 20
-#define HMAC_SHA1_96_CHECK_LEN 12
-#define HMAC_SHA1_CHECK_LEN 20
-
-/* HMAC-SHA512 */
-#define HMAC_SHA512_KEY_LEN 64
-#define HMAC_SHA512_256_CHECK_LEN 32
-#define HMAC_SHA512_CHECK_LEN 64
-
-#endif
similarity index 96%
rename from test/validation/api/crypto/test_vectors.h
rename to test/validation/api/crypto_test_vectors.h
@@ -7,7 +7,73 @@
#ifndef _ODP_TEST_CRYPTO_VECTORS_H_
#define _ODP_TEST_CRYPTO_VECTORS_H_
-#include "test_vectors_len.h"
+/* Maximum */
+#define MAX_KEY_LEN 64
+#define MAX_IV_LEN 16
+#define MAX_DATA_LEN 128
+#define MAX_AAD_LEN 12
+#define MAX_DIGEST_LEN 64
+
+/* TDES-CBC */
+#define TDES_CBC_KEY_LEN 24
+#define TDES_CBC_IV_LEN 8
+
+/* AES-CBC common */
+#define AES_CBC_IV_LEN 16
+
+/* AES128-CBC */
+#define AES128_CBC_KEY_LEN 16
+
+/* AES192-CBC */
+#define AES192_CBC_KEY_LEN 24
+
+/* AES256-CBC */
+#define AES256_CBC_KEY_LEN 32
+
+/* AES-CBC common */
+#define AES_CTR_IV_LEN 16
+
+/* AES128-CTR */
+#define AES128_CTR_KEY_LEN 16
+
+/* AES192-CTR */
+#define AES192_CTR_KEY_LEN 24
+
+/* AES256-CTR */
+#define AES256_CTR_KEY_LEN 32
+
+/* AES-GCM common */
+#define AES_GCM_IV_LEN 12
+#define AES_GCM_DIGEST_LEN 16
+
+/* AES128-GCM */
+#define AES128_GCM_KEY_LEN 16
+
+/* AES192-GCM */
+#define AES192_GCM_KEY_LEN 24
+
+/* AES256-GCM */
+#define AES256_GCM_KEY_LEN 32
+
+/* HMAC-MD5 */
+#define HMAC_MD5_KEY_LEN 16
+#define HMAC_MD5_96_CHECK_LEN 12
+#define HMAC_MD5_CHECK_LEN 16
+
+/* HMAC-SHA256 */
+#define HMAC_SHA256_KEY_LEN 32
+#define HMAC_SHA256_128_CHECK_LEN 16
+#define HMAC_SHA256_CHECK_LEN 32
+
+/* HMAC-SHA1 */
+#define HMAC_SHA1_KEY_LEN 20
+#define HMAC_SHA1_96_CHECK_LEN 12
+#define HMAC_SHA1_CHECK_LEN 20
+
+/* HMAC-SHA512 */
+#define HMAC_SHA512_KEY_LEN 64
+#define HMAC_SHA512_256_CHECK_LEN 32
+#define HMAC_SHA512_CHECK_LEN 64
typedef struct crypto_test_reference_s {
uint32_t cipher_key_length;
similarity index 100%
rename from test/validation/api/errno/errno.c
rename to test/validation/api/errno.c
deleted file mode 100644
@@ -1 +0,0 @@
-errno_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = errno_main
-errno_main_SOURCES = errno.c
similarity index 100%
rename from test/validation/api/event/event.c
rename to test/validation/api/event.c
deleted file mode 100644
@@ -1 +0,0 @@
-event_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = event_main
-event_main_SOURCES = event.c
similarity index 100%
rename from test/validation/api/hash/hash.c
rename to test/validation/api/hash.c
deleted file mode 100644
@@ -1 +0,0 @@
-hash_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = hash_main
-hash_main_SOURCES = hash.c
deleted file mode 100644
@@ -1,3 +0,0 @@
-init_main_abort
-init_main_log
-init_main_ok
deleted file mode 100644
@@ -1,9 +0,0 @@
-include ../Makefile.inc
-
-# most platforms are expected not to support multiple ODP inits
-# following each other: therefore 3 separate binaries are
-# created, each containing its ODP init test.
-test_PROGRAMS = init_main_abort init_main_log init_main_ok
-init_main_abort_SOURCES = init_main_abort.c
-init_main_log_SOURCES = init_main_log.c
-init_main_ok_SOURCES = init_main_ok.c
similarity index 100%
rename from test/validation/api/init/init_main_abort.c
rename to test/validation/api/init_main_abort.c
similarity index 100%
rename from test/validation/api/init/init_main_log.c
rename to test/validation/api/init_main_log.c
similarity index 100%
rename from test/validation/api/init/init_main_ok.c
rename to test/validation/api/init_main_ok.c
similarity index 99%
rename from test/validation/api/ipsec/ipsec.c
rename to test/validation/api/ipsec.c
@@ -12,7 +12,7 @@
#include "ipsec.h"
-#include "test_vectors.h"
+#include "ipsec_test_vectors.h"
struct suite_context_s suite_context;
similarity index 100%
rename from test/validation/api/ipsec/ipsec.h
rename to test/validation/api/ipsec.h
similarity index 100%
rename from test/validation/api/ipsec/ipsec_async.c
rename to test/validation/api/ipsec_async.c
similarity index 100%
rename from test/validation/api/ipsec/ipsec_inline_in.c
rename to test/validation/api/ipsec_inline_in.c
similarity index 100%
rename from test/validation/api/ipsec/ipsec_inline_out.c
rename to test/validation/api/ipsec_inline_out.c
similarity index 100%
rename from test/validation/api/ipsec/ipsec_sync.c
rename to test/validation/api/ipsec_sync.c
similarity index 99%
rename from test/validation/api/ipsec/ipsec_test_in.c
rename to test/validation/api/ipsec_test_in.c
@@ -8,7 +8,7 @@
#include "ipsec.h"
-#include "test_vectors.h"
+#include "ipsec_test_vectors.h"
static void test_in_ipv4_ah_sha256(void)
{
similarity index 99%
rename from test/validation/api/ipsec/ipsec_test_out.c
rename to test/validation/api/ipsec_test_out.c
@@ -8,7 +8,7 @@
#include "ipsec.h"
-#include "test_vectors.h"
+#include "ipsec_test_vectors.h"
static void test_out_ipv4_ah_sha256(void)
{
similarity index 100%
rename from test/validation/api/ipsec/test_vectors.h
rename to test/validation/api/ipsec_test_vectors.h
similarity index 100%
rename from test/validation/api/lock/lock.c
rename to test/validation/api/lock.c
deleted file mode 100644
@@ -1 +0,0 @@
-lock_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = lock_main
-lock_main_SOURCES = lock.c
similarity index 100%
rename from test/validation/api/packet/packet.c
rename to test/validation/api/packet.c
deleted file mode 100644
@@ -1 +0,0 @@
-packet_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = packet_main
-packet_main_SOURCES = packet.c
similarity index 100%
rename from test/validation/api/pool/pool.c
rename to test/validation/api/pool.c
deleted file mode 100644
@@ -1 +0,0 @@
-pool_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = pool_main
-pool_main_SOURCES = pool.c
similarity index 100%
rename from test/validation/api/queue/queue.c
rename to test/validation/api/queue.c
deleted file mode 100644
@@ -1 +0,0 @@
-queue_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = queue_main
-queue_main_SOURCES = queue.c
similarity index 100%
rename from test/validation/api/random/random.c
rename to test/validation/api/random.c
deleted file mode 100644
@@ -1 +0,0 @@
-random_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = random_main
-random_main_SOURCES = random.c
similarity index 100%
rename from test/validation/api/scheduler/scheduler.c
rename to test/validation/api/scheduler.c
deleted file mode 100644
@@ -1 +0,0 @@
-scheduler_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = scheduler_main
-scheduler_main_SOURCES = scheduler.c
similarity index 100%
rename from test/validation/api/shmem/shmem.c
rename to test/validation/api/shmem.c
deleted file mode 100644
@@ -1 +0,0 @@
-shmem_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = shmem_main
-shmem_main_SOURCES = shmem.c
similarity index 100%
rename from test/validation/api/std_clib/std_clib.c
rename to test/validation/api/std_clib.c
deleted file mode 100644
@@ -1 +0,0 @@
-std_clib_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = std_clib_main
-std_clib_main_SOURCES = std_clib.c
similarity index 100%
rename from test/validation/api/system/system.c
rename to test/validation/api/system.c
deleted file mode 100644
@@ -1 +0,0 @@
-system_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = system_main
-system_main_SOURCES = system.c
similarity index 99%
rename from test/validation/api/thread/thread.c
rename to test/validation/api/thread.c
@@ -6,6 +6,7 @@
#include "config.h"
+#define TEST_THRMASK
#include <odp_api.h>
#include <odp_cunit_common.h>
#include <mask_common.h>
deleted file mode 100644
@@ -1 +0,0 @@
-thread_main
deleted file mode 100644
@@ -1,6 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = thread_main
-thread_main_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_THRMASK
-thread_main_SOURCES = thread.c
-LDADD += $(LIBTHRMASK_COMMON)
similarity index 100%
rename from test/validation/api/time/time.c
rename to test/validation/api/time.c
deleted file mode 100644
@@ -1 +0,0 @@
-time_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = time_main
-time_main_SOURCES = time.c
similarity index 100%
rename from test/validation/api/timer/timer.c
rename to test/validation/api/timer.c
deleted file mode 100644
@@ -1 +0,0 @@
-timer_main
deleted file mode 100644
@@ -1,4 +0,0 @@
-include ../Makefile.inc
-
-test_PROGRAMS = timer_main
-timer_main_SOURCES = timer.c