From patchwork Thu Feb 22 09:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129169 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp377671lja; Thu, 22 Feb 2018 01:09:26 -0800 (PST) X-Google-Smtp-Source: AH8x226woOYFEw62R/bm0eA4H3T2z09Ul+CeKkKVqA0NU/2z1i/pigHzdZL2CgHNbwSOD6YxbUIC X-Received: by 10.233.237.2 with SMTP id c2mr9266537qkg.54.1519290565772; Thu, 22 Feb 2018 01:09:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519290565; cv=none; d=google.com; s=arc-20160816; b=LdO7WWDthbUdlxqHk5KAwkhdaXrOyrRgLJYUPa9MWdNfE+8gyH/c5qaensqZG2P7n7 wukYNRO5uXk9zTebNhGrUcjStPJBKq/JUj04Bi8gYlwQde6o8np6sKrYp1tY3undYkmb xIjivbAA6bgafwe417/pBYy9VlO7oPi/96ouTY0UfvbrA3Ff8AnqSUeux9kDfa9YpHaV CHZv/GbGWGiladpgE6IhjB7aw3MckJ0yPDO+NmyG4YuzWOddmxZA+dWgodmpsILsSwIh jvZVt4XXOwMMUmjg3zJRM7u8450Sd+pWVb06ZR45VHFQxWjt8jg5fNL789RV6NSDlgkN 5jWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=ZXF5WC+8vninnD+UPJmFiZWqpAA2PuJZ0VU0SWyJtQk=; b=lYXVE1d9KAKxfwZ9uKr0tDiCWR9QyMaAPC8Jm6QaAUp745GsAJ04mzKgGPlpms6Mb3 FFg/19ch2zmGfL8oPkPmxLzyEhLxNz9F+HPN5SwSVM1/fz6euq1C+MuI/IikK4MiN0cE A0q0C65qqN8slOvEm57WEveoojf1l6HmPdlaVboGHPXVv3QZkrNwMRaEwRd6xFyA9tLB 2sewJfdZcyRm/1ypJCNCr7dPq1WiB/xNqRqK1x9nCoILAWLpm0CkcPbjzc+XTHm+Wa3U MrbHPMt0hrRqX1rM17pxQHKCueKScd+ax1TLjsaARuHAFavaMBwG1HVytlUWI6G6oQpV c9jg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id 27si1346961qkr.129.2018.02.22.01.09.25; Thu, 22 Feb 2018 01:09:25 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 57DBE60130; Thu, 22 Feb 2018 09:09:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C740B60C56; Thu, 22 Feb 2018 09:08:17 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id EA46661754; Thu, 22 Feb 2018 09:07:41 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 592896170B for ; Thu, 22 Feb 2018 09:04:02 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 2F1D4186DE0 for ; Thu, 22 Feb 2018 12:00:18 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id KOL83isqEQ-0I34gdjH; Thu, 22 Feb 2018 12:00:18 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Qk3Eeopztj-0GHOkr8L; Thu, 22 Feb 2018 12:00:16 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 22 Feb 2018 12:00:08 +0300 Message-Id: <1519290010-13383-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519290010-13383-1-git-send-email-odpbot@yandex.ru> References: <1519290010-13383-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 496 Subject: [lng-odp] [PATCH v1 5/7] validation: move most of tests to common directory X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov There is little benefit from keeping each test in it's own subdirectory. It just slows down build process. Move most of the tests to just api/ diretory to be built in parallel. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 496 (lumag:tests-fix-2) ** https://github.com/Linaro/odp/pull/496 ** Patch: https://github.com/Linaro/odp/pull/496.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: 2ca48deb89c7ac000bd44a1da037c36de66720cb **/ test/m4/configure.m4 | 24 - test/validation/api/.gitignore | 29 + test/validation/api/Makefile.am | 173 +- test/validation/api/{atomic => }/atomic.c | 0 test/validation/api/atomic/.gitignore | 1 - test/validation/api/atomic/Makefile.am | 4 - test/validation/api/{barrier => }/barrier.c | 0 test/validation/api/barrier/.gitignore | 1 - test/validation/api/barrier/Makefile.am | 4 - test/validation/api/{buffer => }/buffer.c | 0 test/validation/api/buffer/.gitignore | 1 - test/validation/api/buffer/Makefile.am | 4 - test/validation/api/{chksum => }/chksum.c | 0 test/validation/api/chksum/.gitignore | 1 - test/validation/api/chksum/Makefile.am | 4 - .../api/{classification => }/classification.c | 2 +- .../api/{classification => }/classification.h | 0 test/validation/api/classification/.gitignore | 1 - test/validation/api/classification/Makefile.am | 11 - .../api/classification/odp_classification_basic.c | 336 ---- .../api/classification/odp_classification_common.c | 428 ----- .../classification/odp_classification_test_pmr.c | 1963 -------------------- .../api/classification/odp_classification_tests.c | 724 -------- .../classification/odp_classification_testsuites.h | 63 - test/validation/api/{cpumask => }/cpumask.c | 0 test/validation/api/cpumask/.gitignore | 1 - test/validation/api/cpumask/Makefile.am | 5 - .../api/{crypto/odp_crypto_test_inp.c => crypto.c} | 2 +- test/validation/api/crypto/.gitignore | 1 - test/validation/api/crypto/Makefile.am | 7 - test/validation/api/crypto/test_vectors_len.h | 77 - .../test_vectors.h => crypto_test_vectors.h} | 68 +- test/validation/api/{errno => }/errno.c | 0 test/validation/api/errno/.gitignore | 1 - test/validation/api/errno/Makefile.am | 4 - test/validation/api/{event => }/event.c | 0 test/validation/api/event/.gitignore | 1 - test/validation/api/event/Makefile.am | 4 - test/validation/api/{hash => }/hash.c | 0 test/validation/api/hash/.gitignore | 1 - test/validation/api/hash/Makefile.am | 4 - test/validation/api/init/.gitignore | 3 - test/validation/api/init/Makefile.am | 9 - test/validation/api/{init => }/init_main_abort.c | 0 test/validation/api/{init => }/init_main_log.c | 0 test/validation/api/{init => }/init_main_ok.c | 0 test/validation/api/{ipsec => }/ipsec.c | 2 +- test/validation/api/{ipsec => }/ipsec.h | 0 test/validation/api/{ipsec => }/ipsec_async.c | 0 test/validation/api/{ipsec => }/ipsec_inline_in.c | 0 test/validation/api/{ipsec => }/ipsec_inline_out.c | 0 test/validation/api/{ipsec => }/ipsec_sync.c | 0 test/validation/api/{ipsec => }/ipsec_test_in.c | 2 +- test/validation/api/{ipsec => }/ipsec_test_out.c | 2 +- .../{ipsec/test_vectors.h => ipsec_test_vectors.h} | 0 test/validation/api/{lock => }/lock.c | 0 test/validation/api/lock/.gitignore | 1 - test/validation/api/lock/Makefile.am | 4 - test/validation/api/{packet => }/packet.c | 0 test/validation/api/packet/.gitignore | 1 - test/validation/api/packet/Makefile.am | 4 - test/validation/api/{pool => }/pool.c | 0 test/validation/api/pool/.gitignore | 1 - test/validation/api/pool/Makefile.am | 4 - test/validation/api/{queue => }/queue.c | 0 test/validation/api/queue/.gitignore | 1 - test/validation/api/queue/Makefile.am | 4 - test/validation/api/{random => }/random.c | 0 test/validation/api/random/.gitignore | 1 - test/validation/api/random/Makefile.am | 4 - test/validation/api/{scheduler => }/scheduler.c | 0 test/validation/api/scheduler/.gitignore | 1 - test/validation/api/scheduler/Makefile.am | 4 - test/validation/api/{shmem => }/shmem.c | 0 test/validation/api/shmem/.gitignore | 1 - test/validation/api/shmem/Makefile.am | 4 - test/validation/api/{std_clib => }/std_clib.c | 0 test/validation/api/std_clib/.gitignore | 1 - test/validation/api/std_clib/Makefile.am | 4 - test/validation/api/{system => }/system.c | 0 test/validation/api/system/.gitignore | 1 - test/validation/api/system/Makefile.am | 4 - test/validation/api/{thread => }/thread.c | 1 + test/validation/api/thread/.gitignore | 1 - test/validation/api/thread/Makefile.am | 6 - test/validation/api/{time => }/time.c | 0 test/validation/api/time/.gitignore | 1 - test/validation/api/time/Makefile.am | 4 - test/validation/api/{timer => }/timer.c | 0 test/validation/api/timer/.gitignore | 1 - test/validation/api/timer/Makefile.am | 4 - 91 files changed, 219 insertions(+), 3812 deletions(-) rename test/validation/api/{atomic => }/atomic.c (100%) delete mode 100644 test/validation/api/atomic/.gitignore delete mode 100644 test/validation/api/atomic/Makefile.am rename test/validation/api/{barrier => }/barrier.c (100%) delete mode 100644 test/validation/api/barrier/.gitignore delete mode 100644 test/validation/api/barrier/Makefile.am rename test/validation/api/{buffer => }/buffer.c (100%) delete mode 100644 test/validation/api/buffer/.gitignore delete mode 100644 test/validation/api/buffer/Makefile.am rename test/validation/api/{chksum => }/chksum.c (100%) delete mode 100644 test/validation/api/chksum/.gitignore delete mode 100644 test/validation/api/chksum/Makefile.am rename test/validation/api/{classification => }/classification.c (95%) rename test/validation/api/{classification => }/classification.h (100%) delete mode 100644 test/validation/api/classification/.gitignore delete mode 100644 test/validation/api/classification/Makefile.am delete mode 100644 test/validation/api/classification/odp_classification_basic.c delete mode 100644 test/validation/api/classification/odp_classification_common.c delete mode 100644 test/validation/api/classification/odp_classification_test_pmr.c delete mode 100644 test/validation/api/classification/odp_classification_tests.c delete mode 100644 test/validation/api/classification/odp_classification_testsuites.h rename test/validation/api/{cpumask => }/cpumask.c (100%) delete mode 100644 test/validation/api/cpumask/.gitignore delete mode 100644 test/validation/api/cpumask/Makefile.am rename test/validation/api/{crypto/odp_crypto_test_inp.c => crypto.c} (99%) delete mode 100644 test/validation/api/crypto/.gitignore delete mode 100644 test/validation/api/crypto/Makefile.am delete mode 100644 test/validation/api/crypto/test_vectors_len.h rename test/validation/api/{crypto/test_vectors.h => crypto_test_vectors.h} (96%) rename test/validation/api/{errno => }/errno.c (100%) delete mode 100644 test/validation/api/errno/.gitignore delete mode 100644 test/validation/api/errno/Makefile.am rename test/validation/api/{event => }/event.c (100%) delete mode 100644 test/validation/api/event/.gitignore delete mode 100644 test/validation/api/event/Makefile.am rename test/validation/api/{hash => }/hash.c (100%) delete mode 100644 test/validation/api/hash/.gitignore delete mode 100644 test/validation/api/hash/Makefile.am delete mode 100644 test/validation/api/init/.gitignore delete mode 100644 test/validation/api/init/Makefile.am rename test/validation/api/{init => }/init_main_abort.c (100%) rename test/validation/api/{init => }/init_main_log.c (100%) rename test/validation/api/{init => }/init_main_ok.c (100%) rename test/validation/api/{ipsec => }/ipsec.c (99%) rename test/validation/api/{ipsec => }/ipsec.h (100%) rename test/validation/api/{ipsec => }/ipsec_async.c (100%) rename test/validation/api/{ipsec => }/ipsec_inline_in.c (100%) rename test/validation/api/{ipsec => }/ipsec_inline_out.c (100%) rename test/validation/api/{ipsec => }/ipsec_sync.c (100%) rename test/validation/api/{ipsec => }/ipsec_test_in.c (99%) rename test/validation/api/{ipsec => }/ipsec_test_out.c (99%) rename test/validation/api/{ipsec/test_vectors.h => ipsec_test_vectors.h} (100%) rename test/validation/api/{lock => }/lock.c (100%) delete mode 100644 test/validation/api/lock/.gitignore delete mode 100644 test/validation/api/lock/Makefile.am rename test/validation/api/{packet => }/packet.c (100%) delete mode 100644 test/validation/api/packet/.gitignore delete mode 100644 test/validation/api/packet/Makefile.am rename test/validation/api/{pool => }/pool.c (100%) delete mode 100644 test/validation/api/pool/.gitignore delete mode 100644 test/validation/api/pool/Makefile.am rename test/validation/api/{queue => }/queue.c (100%) delete mode 100644 test/validation/api/queue/.gitignore delete mode 100644 test/validation/api/queue/Makefile.am rename test/validation/api/{random => }/random.c (100%) delete mode 100644 test/validation/api/random/.gitignore delete mode 100644 test/validation/api/random/Makefile.am rename test/validation/api/{scheduler => }/scheduler.c (100%) delete mode 100644 test/validation/api/scheduler/.gitignore delete mode 100644 test/validation/api/scheduler/Makefile.am rename test/validation/api/{shmem => }/shmem.c (100%) delete mode 100644 test/validation/api/shmem/.gitignore delete mode 100644 test/validation/api/shmem/Makefile.am rename test/validation/api/{std_clib => }/std_clib.c (100%) delete mode 100644 test/validation/api/std_clib/.gitignore delete mode 100644 test/validation/api/std_clib/Makefile.am rename test/validation/api/{system => }/system.c (100%) delete mode 100644 test/validation/api/system/.gitignore delete mode 100644 test/validation/api/system/Makefile.am rename test/validation/api/{thread => }/thread.c (99%) delete mode 100644 test/validation/api/thread/.gitignore delete mode 100644 test/validation/api/thread/Makefile.am rename test/validation/api/{time => }/time.c (100%) delete mode 100644 test/validation/api/time/.gitignore delete mode 100644 test/validation/api/time/Makefile.am rename test/validation/api/{timer => }/timer.c (100%) delete mode 100644 test/validation/api/timer/.gitignore delete mode 100644 test/validation/api/timer/Makefile.am diff --git a/test/m4/configure.m4 b/test/m4/configure.m4 index dd07839ff..5a0b4d685 100644 --- a/test/m4/configure.m4 +++ b/test/m4/configure.m4 @@ -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]) diff --git a/test/validation/api/.gitignore b/test/validation/api/.gitignore index 5dabf91c1..6fb6ee62e 100644 --- a/test/validation/api/.gitignore +++ b/test/validation/api/.gitignore @@ -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 diff --git a/test/validation/api/Makefile.am b/test/validation/api/Makefile.am index c92d123c1..bc3a429d2 100644 --- a/test/validation/api/Makefile.am +++ b/test/validation/api/Makefile.am @@ -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 diff --git a/test/validation/api/atomic/atomic.c b/test/validation/api/atomic.c similarity index 100% rename from test/validation/api/atomic/atomic.c rename to test/validation/api/atomic.c diff --git a/test/validation/api/atomic/.gitignore b/test/validation/api/atomic/.gitignore deleted file mode 100644 index 610ffeab0..000000000 --- a/test/validation/api/atomic/.gitignore +++ /dev/null @@ -1 +0,0 @@ -atomic_main diff --git a/test/validation/api/atomic/Makefile.am b/test/validation/api/atomic/Makefile.am deleted file mode 100644 index 41ad2e6b6..000000000 --- a/test/validation/api/atomic/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = atomic_main -atomic_main_SOURCES = atomic.c diff --git a/test/validation/api/barrier/barrier.c b/test/validation/api/barrier.c similarity index 100% rename from test/validation/api/barrier/barrier.c rename to test/validation/api/barrier.c diff --git a/test/validation/api/barrier/.gitignore b/test/validation/api/barrier/.gitignore deleted file mode 100644 index 2e0ee7ade..000000000 --- a/test/validation/api/barrier/.gitignore +++ /dev/null @@ -1 +0,0 @@ -barrier_main diff --git a/test/validation/api/barrier/Makefile.am b/test/validation/api/barrier/Makefile.am deleted file mode 100644 index f5f751b88..000000000 --- a/test/validation/api/barrier/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = barrier_main -barrier_main_SOURCES = barrier.c diff --git a/test/validation/api/buffer/buffer.c b/test/validation/api/buffer.c similarity index 100% rename from test/validation/api/buffer/buffer.c rename to test/validation/api/buffer.c diff --git a/test/validation/api/buffer/.gitignore b/test/validation/api/buffer/.gitignore deleted file mode 100644 index 0e8ac15c1..000000000 --- a/test/validation/api/buffer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -buffer_main diff --git a/test/validation/api/buffer/Makefile.am b/test/validation/api/buffer/Makefile.am deleted file mode 100644 index f459010c3..000000000 --- a/test/validation/api/buffer/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = buffer_main -buffer_main_SOURCES = buffer.c diff --git a/test/validation/api/chksum/chksum.c b/test/validation/api/chksum.c similarity index 100% rename from test/validation/api/chksum/chksum.c rename to test/validation/api/chksum.c diff --git a/test/validation/api/chksum/.gitignore b/test/validation/api/chksum/.gitignore deleted file mode 100644 index c69e8c470..000000000 --- a/test/validation/api/chksum/.gitignore +++ /dev/null @@ -1 +0,0 @@ -chksum_main diff --git a/test/validation/api/chksum/Makefile.am b/test/validation/api/chksum/Makefile.am deleted file mode 100644 index 349fdd641..000000000 --- a/test/validation/api/chksum/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = chksum_main -chksum_main_SOURCES = chksum.c diff --git a/test/validation/api/classification/classification.c b/test/validation/api/classification.c similarity index 95% rename from test/validation/api/classification/classification.c rename to test/validation/api/classification.c index e89ffbee4..ddff5dd74 100644 --- a/test/validation/api/classification/classification.c +++ b/test/validation/api/classification.c @@ -8,7 +8,7 @@ #include #include -#include "odp_classification_testsuites.h" +#include "classification_testsuites.h" #include "classification.h" odp_suiteinfo_t classification_suites[] = { diff --git a/test/validation/api/classification/classification.h b/test/validation/api/classification.h similarity index 100% rename from test/validation/api/classification/classification.h rename to test/validation/api/classification.h diff --git a/test/validation/api/classification/.gitignore b/test/validation/api/classification/.gitignore deleted file mode 100644 index e2cdfefe1..000000000 --- a/test/validation/api/classification/.gitignore +++ /dev/null @@ -1 +0,0 @@ -classification_main diff --git a/test/validation/api/classification/Makefile.am b/test/validation/api/classification/Makefile.am deleted file mode 100644 index e17f9f654..000000000 --- a/test/validation/api/classification/Makefile.am +++ /dev/null @@ -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 diff --git a/test/validation/api/classification/odp_classification_basic.c b/test/validation/api/classification/odp_classification_basic.c deleted file mode 100644 index 8b3738b75..000000000 --- a/test/validation/api/classification/odp_classification_basic.c +++ /dev/null @@ -1,336 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "config.h" - -#include -#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, -}; diff --git a/test/validation/api/classification/odp_classification_common.c b/test/validation/api/classification/odp_classification_common.c deleted file mode 100644 index 60e20ea87..000000000 --- a/test/validation/api/classification/odp_classification_common.c +++ /dev/null @@ -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 -#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; -} diff --git a/test/validation/api/classification/odp_classification_test_pmr.c b/test/validation/api/classification/odp_classification_test_pmr.c deleted file mode 100644 index f21b8addd..000000000 --- a/test/validation/api/classification/odp_classification_test_pmr.c +++ /dev/null @@ -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 - -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, -}; diff --git a/test/validation/api/classification/odp_classification_tests.c b/test/validation/api/classification/odp_classification_tests.c deleted file mode 100644 index 4cd727f9a..000000000 --- a/test/validation/api/classification/odp_classification_tests.c +++ /dev/null @@ -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 - -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, -}; diff --git a/test/validation/api/classification/odp_classification_testsuites.h b/test/validation/api/classification/odp_classification_testsuites.h deleted file mode 100644 index e1624162f..000000000 --- a/test/validation/api/classification/odp_classification_testsuites.h +++ /dev/null @@ -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 -#include -#include -#include - -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_ */ diff --git a/test/validation/api/cpumask/cpumask.c b/test/validation/api/cpumask.c similarity index 100% rename from test/validation/api/cpumask/cpumask.c rename to test/validation/api/cpumask.c diff --git a/test/validation/api/cpumask/.gitignore b/test/validation/api/cpumask/.gitignore deleted file mode 100644 index 655a1640f..000000000 --- a/test/validation/api/cpumask/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cpumask_main diff --git a/test/validation/api/cpumask/Makefile.am b/test/validation/api/cpumask/Makefile.am deleted file mode 100644 index 3872c1bd4..000000000 --- a/test/validation/api/cpumask/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = cpumask_main -cpumask_main_SOURCES = cpumask.c -LDADD += $(LIBCPUMASK_COMMON) diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto.c similarity index 99% rename from test/validation/api/crypto/odp_crypto_test_inp.c rename to test/validation/api/crypto.c index ec477535f..de449d480 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto.c @@ -9,7 +9,7 @@ #include #include #include -#include "test_vectors.h" +#include "crypto_test_vectors.h" #define MAX_ALG_CAPA 32 diff --git a/test/validation/api/crypto/.gitignore b/test/validation/api/crypto/.gitignore deleted file mode 100644 index 0ac55e35e..000000000 --- a/test/validation/api/crypto/.gitignore +++ /dev/null @@ -1 +0,0 @@ -crypto_main diff --git a/test/validation/api/crypto/Makefile.am b/test/validation/api/crypto/Makefile.am deleted file mode 100644 index cc4d49d60..000000000 --- a/test/validation/api/crypto/Makefile.am +++ /dev/null @@ -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 diff --git a/test/validation/api/crypto/test_vectors_len.h b/test/validation/api/crypto/test_vectors_len.h deleted file mode 100644 index 140bef2a2..000000000 --- a/test/validation/api/crypto/test_vectors_len.h +++ /dev/null @@ -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 diff --git a/test/validation/api/crypto/test_vectors.h b/test/validation/api/crypto_test_vectors.h similarity index 96% rename from test/validation/api/crypto/test_vectors.h rename to test/validation/api/crypto_test_vectors.h index 6592a3357..061db05bc 100644 --- a/test/validation/api/crypto/test_vectors.h +++ b/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; diff --git a/test/validation/api/errno/errno.c b/test/validation/api/errno.c similarity index 100% rename from test/validation/api/errno/errno.c rename to test/validation/api/errno.c diff --git a/test/validation/api/errno/.gitignore b/test/validation/api/errno/.gitignore deleted file mode 100644 index 12256e38c..000000000 --- a/test/validation/api/errno/.gitignore +++ /dev/null @@ -1 +0,0 @@ -errno_main diff --git a/test/validation/api/errno/Makefile.am b/test/validation/api/errno/Makefile.am deleted file mode 100644 index de13afbfb..000000000 --- a/test/validation/api/errno/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = errno_main -errno_main_SOURCES = errno.c diff --git a/test/validation/api/event/event.c b/test/validation/api/event.c similarity index 100% rename from test/validation/api/event/event.c rename to test/validation/api/event.c diff --git a/test/validation/api/event/.gitignore b/test/validation/api/event/.gitignore deleted file mode 100644 index 05d34d7c8..000000000 --- a/test/validation/api/event/.gitignore +++ /dev/null @@ -1 +0,0 @@ -event_main diff --git a/test/validation/api/event/Makefile.am b/test/validation/api/event/Makefile.am deleted file mode 100644 index 0d26035ed..000000000 --- a/test/validation/api/event/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = event_main -event_main_SOURCES = event.c diff --git a/test/validation/api/hash/hash.c b/test/validation/api/hash.c similarity index 100% rename from test/validation/api/hash/hash.c rename to test/validation/api/hash.c diff --git a/test/validation/api/hash/.gitignore b/test/validation/api/hash/.gitignore deleted file mode 100644 index 6d0bc9314..000000000 --- a/test/validation/api/hash/.gitignore +++ /dev/null @@ -1 +0,0 @@ -hash_main diff --git a/test/validation/api/hash/Makefile.am b/test/validation/api/hash/Makefile.am deleted file mode 100644 index 0d843ea74..000000000 --- a/test/validation/api/hash/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = hash_main -hash_main_SOURCES = hash.c diff --git a/test/validation/api/init/.gitignore b/test/validation/api/init/.gitignore deleted file mode 100644 index f433708b0..000000000 --- a/test/validation/api/init/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -init_main_abort -init_main_log -init_main_ok diff --git a/test/validation/api/init/Makefile.am b/test/validation/api/init/Makefile.am deleted file mode 100644 index 5af2e00bc..000000000 --- a/test/validation/api/init/Makefile.am +++ /dev/null @@ -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 diff --git a/test/validation/api/init/init_main_abort.c b/test/validation/api/init_main_abort.c similarity index 100% rename from test/validation/api/init/init_main_abort.c rename to test/validation/api/init_main_abort.c diff --git a/test/validation/api/init/init_main_log.c b/test/validation/api/init_main_log.c similarity index 100% rename from test/validation/api/init/init_main_log.c rename to test/validation/api/init_main_log.c diff --git a/test/validation/api/init/init_main_ok.c b/test/validation/api/init_main_ok.c similarity index 100% rename from test/validation/api/init/init_main_ok.c rename to test/validation/api/init_main_ok.c diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec.c similarity index 99% rename from test/validation/api/ipsec/ipsec.c rename to test/validation/api/ipsec.c index b16f84ac9..b4c5f9cba 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/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; diff --git a/test/validation/api/ipsec/ipsec.h b/test/validation/api/ipsec.h similarity index 100% rename from test/validation/api/ipsec/ipsec.h rename to test/validation/api/ipsec.h diff --git a/test/validation/api/ipsec/ipsec_async.c b/test/validation/api/ipsec_async.c similarity index 100% rename from test/validation/api/ipsec/ipsec_async.c rename to test/validation/api/ipsec_async.c diff --git a/test/validation/api/ipsec/ipsec_inline_in.c b/test/validation/api/ipsec_inline_in.c similarity index 100% rename from test/validation/api/ipsec/ipsec_inline_in.c rename to test/validation/api/ipsec_inline_in.c diff --git a/test/validation/api/ipsec/ipsec_inline_out.c b/test/validation/api/ipsec_inline_out.c similarity index 100% rename from test/validation/api/ipsec/ipsec_inline_out.c rename to test/validation/api/ipsec_inline_out.c diff --git a/test/validation/api/ipsec/ipsec_sync.c b/test/validation/api/ipsec_sync.c similarity index 100% rename from test/validation/api/ipsec/ipsec_sync.c rename to test/validation/api/ipsec_sync.c diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec_test_in.c similarity index 99% rename from test/validation/api/ipsec/ipsec_test_in.c rename to test/validation/api/ipsec_test_in.c index 6262f4cb5..606a64428 100644 --- a/test/validation/api/ipsec/ipsec_test_in.c +++ b/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) { diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec_test_out.c similarity index 99% rename from test/validation/api/ipsec/ipsec_test_out.c rename to test/validation/api/ipsec_test_out.c index 4751e6ec8..29f09711f 100644 --- a/test/validation/api/ipsec/ipsec_test_out.c +++ b/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) { diff --git a/test/validation/api/ipsec/test_vectors.h b/test/validation/api/ipsec_test_vectors.h similarity index 100% rename from test/validation/api/ipsec/test_vectors.h rename to test/validation/api/ipsec_test_vectors.h diff --git a/test/validation/api/lock/lock.c b/test/validation/api/lock.c similarity index 100% rename from test/validation/api/lock/lock.c rename to test/validation/api/lock.c diff --git a/test/validation/api/lock/.gitignore b/test/validation/api/lock/.gitignore deleted file mode 100644 index ff16646f4..000000000 --- a/test/validation/api/lock/.gitignore +++ /dev/null @@ -1 +0,0 @@ -lock_main diff --git a/test/validation/api/lock/Makefile.am b/test/validation/api/lock/Makefile.am deleted file mode 100644 index ad75e1854..000000000 --- a/test/validation/api/lock/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = lock_main -lock_main_SOURCES = lock.c diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet.c similarity index 100% rename from test/validation/api/packet/packet.c rename to test/validation/api/packet.c diff --git a/test/validation/api/packet/.gitignore b/test/validation/api/packet/.gitignore deleted file mode 100644 index c05530d2d..000000000 --- a/test/validation/api/packet/.gitignore +++ /dev/null @@ -1 +0,0 @@ -packet_main diff --git a/test/validation/api/packet/Makefile.am b/test/validation/api/packet/Makefile.am deleted file mode 100644 index ad5775d7e..000000000 --- a/test/validation/api/packet/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = packet_main -packet_main_SOURCES = packet.c diff --git a/test/validation/api/pool/pool.c b/test/validation/api/pool.c similarity index 100% rename from test/validation/api/pool/pool.c rename to test/validation/api/pool.c diff --git a/test/validation/api/pool/.gitignore b/test/validation/api/pool/.gitignore deleted file mode 100644 index fc91b28d6..000000000 --- a/test/validation/api/pool/.gitignore +++ /dev/null @@ -1 +0,0 @@ -pool_main diff --git a/test/validation/api/pool/Makefile.am b/test/validation/api/pool/Makefile.am deleted file mode 100644 index 1b0d5934c..000000000 --- a/test/validation/api/pool/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = pool_main -pool_main_SOURCES = pool.c diff --git a/test/validation/api/queue/queue.c b/test/validation/api/queue.c similarity index 100% rename from test/validation/api/queue/queue.c rename to test/validation/api/queue.c diff --git a/test/validation/api/queue/.gitignore b/test/validation/api/queue/.gitignore deleted file mode 100644 index 469506a13..000000000 --- a/test/validation/api/queue/.gitignore +++ /dev/null @@ -1 +0,0 @@ -queue_main diff --git a/test/validation/api/queue/Makefile.am b/test/validation/api/queue/Makefile.am deleted file mode 100644 index 94a6b28a9..000000000 --- a/test/validation/api/queue/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = queue_main -queue_main_SOURCES = queue.c diff --git a/test/validation/api/random/random.c b/test/validation/api/random.c similarity index 100% rename from test/validation/api/random/random.c rename to test/validation/api/random.c diff --git a/test/validation/api/random/.gitignore b/test/validation/api/random/.gitignore deleted file mode 100644 index 2c88ec0b8..000000000 --- a/test/validation/api/random/.gitignore +++ /dev/null @@ -1 +0,0 @@ -random_main diff --git a/test/validation/api/random/Makefile.am b/test/validation/api/random/Makefile.am deleted file mode 100644 index e24ce0af7..000000000 --- a/test/validation/api/random/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = random_main -random_main_SOURCES = random.c diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler.c similarity index 100% rename from test/validation/api/scheduler/scheduler.c rename to test/validation/api/scheduler.c diff --git a/test/validation/api/scheduler/.gitignore b/test/validation/api/scheduler/.gitignore deleted file mode 100644 index b4eb30091..000000000 --- a/test/validation/api/scheduler/.gitignore +++ /dev/null @@ -1 +0,0 @@ -scheduler_main diff --git a/test/validation/api/scheduler/Makefile.am b/test/validation/api/scheduler/Makefile.am deleted file mode 100644 index 050f22308..000000000 --- a/test/validation/api/scheduler/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = scheduler_main -scheduler_main_SOURCES = scheduler.c diff --git a/test/validation/api/shmem/shmem.c b/test/validation/api/shmem.c similarity index 100% rename from test/validation/api/shmem/shmem.c rename to test/validation/api/shmem.c diff --git a/test/validation/api/shmem/.gitignore b/test/validation/api/shmem/.gitignore deleted file mode 100644 index 4d82fd53a..000000000 --- a/test/validation/api/shmem/.gitignore +++ /dev/null @@ -1 +0,0 @@ -shmem_main diff --git a/test/validation/api/shmem/Makefile.am b/test/validation/api/shmem/Makefile.am deleted file mode 100644 index 52e33fdca..000000000 --- a/test/validation/api/shmem/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = shmem_main -shmem_main_SOURCES = shmem.c diff --git a/test/validation/api/std_clib/std_clib.c b/test/validation/api/std_clib.c similarity index 100% rename from test/validation/api/std_clib/std_clib.c rename to test/validation/api/std_clib.c diff --git a/test/validation/api/std_clib/.gitignore b/test/validation/api/std_clib/.gitignore deleted file mode 100644 index 37828330a..000000000 --- a/test/validation/api/std_clib/.gitignore +++ /dev/null @@ -1 +0,0 @@ -std_clib_main diff --git a/test/validation/api/std_clib/Makefile.am b/test/validation/api/std_clib/Makefile.am deleted file mode 100644 index 9d3b32d3f..000000000 --- a/test/validation/api/std_clib/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = std_clib_main -std_clib_main_SOURCES = std_clib.c diff --git a/test/validation/api/system/system.c b/test/validation/api/system.c similarity index 100% rename from test/validation/api/system/system.c rename to test/validation/api/system.c diff --git a/test/validation/api/system/.gitignore b/test/validation/api/system/.gitignore deleted file mode 100644 index 347b1ee21..000000000 --- a/test/validation/api/system/.gitignore +++ /dev/null @@ -1 +0,0 @@ -system_main diff --git a/test/validation/api/system/Makefile.am b/test/validation/api/system/Makefile.am deleted file mode 100644 index 8090b0b5a..000000000 --- a/test/validation/api/system/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = system_main -system_main_SOURCES = system.c diff --git a/test/validation/api/thread/thread.c b/test/validation/api/thread.c similarity index 99% rename from test/validation/api/thread/thread.c rename to test/validation/api/thread.c index fe504e888..f45521766 100644 --- a/test/validation/api/thread/thread.c +++ b/test/validation/api/thread.c @@ -6,6 +6,7 @@ #include "config.h" +#define TEST_THRMASK #include #include #include diff --git a/test/validation/api/thread/.gitignore b/test/validation/api/thread/.gitignore deleted file mode 100644 index ab1787d97..000000000 --- a/test/validation/api/thread/.gitignore +++ /dev/null @@ -1 +0,0 @@ -thread_main diff --git a/test/validation/api/thread/Makefile.am b/test/validation/api/thread/Makefile.am deleted file mode 100644 index cbd8b2a7b..000000000 --- a/test/validation/api/thread/Makefile.am +++ /dev/null @@ -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) diff --git a/test/validation/api/time/time.c b/test/validation/api/time.c similarity index 100% rename from test/validation/api/time/time.c rename to test/validation/api/time.c diff --git a/test/validation/api/time/.gitignore b/test/validation/api/time/.gitignore deleted file mode 100644 index 0ef3e6162..000000000 --- a/test/validation/api/time/.gitignore +++ /dev/null @@ -1 +0,0 @@ -time_main diff --git a/test/validation/api/time/Makefile.am b/test/validation/api/time/Makefile.am deleted file mode 100644 index 9b0392eb9..000000000 --- a/test/validation/api/time/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = time_main -time_main_SOURCES = time.c diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer.c similarity index 100% rename from test/validation/api/timer/timer.c rename to test/validation/api/timer.c diff --git a/test/validation/api/timer/.gitignore b/test/validation/api/timer/.gitignore deleted file mode 100644 index 74e8fa992..000000000 --- a/test/validation/api/timer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -timer_main diff --git a/test/validation/api/timer/Makefile.am b/test/validation/api/timer/Makefile.am deleted file mode 100644 index bc33e731f..000000000 --- a/test/validation/api/timer/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include ../Makefile.inc - -test_PROGRAMS = timer_main -timer_main_SOURCES = timer.c