From patchwork Mon Aug 14 17:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 110058 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4589650qge; Mon, 14 Aug 2017 10:01:28 -0700 (PDT) X-Received: by 10.200.34.162 with SMTP id f31mr31700667qta.132.1502730088626; Mon, 14 Aug 2017 10:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502730088; cv=none; d=google.com; s=arc-20160816; b=DJyWvM6MnSIMwFt8oOLsf7j5p6CZYj1zuB2+xs8pmd8tntpeyeO9Kll5SHTpigpwL5 Esox4Zgs0GjAFZN+i//OyYXEu+tiCaNRd4Cc4Te9SLlJF+GdmNqCnRVrR7ItrZ8BwLh3 ANPo2goLoBNViiadMRfV9SEkXLYWBL2JH8r5OVIsBo56x7ZMAy94DNP0KZrkrwwl3Uqg VTmFPGXlc4G5Uz8dGs3l8fRqvLXyJ/zsbnzGvO7QbyDrl/yZS65yLrN8KfeY3pJYUDgr 9fnxkmYiL+kbAjn4VI0OaSdgNK+61PpHXCQY84RDA0E8eeYMolsN8dZWwdfW53WeZefn 7SOg== 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=PzksQ6SgII09vfcKyPGDaBBfoUaxjpmHKY7KNbT4iK8=; b=NPFiLg/t7LguCLO3eZFxIHSN+HFfvq8/8P+F2gXCl6hc7GNOFWjF4VQ+6W9g2exWP0 s3sKnn4hxAtgjBflQF93z1bPj7jN6kqacoiXRqtF+3Gn5lPTMW8g+Tf/utwc8fEUw3Zc AJFttFYExguxloald/9/OquJr6cAv49WUzyKWbWDQ4n0b+F8B+ffgbeBi1a0ub6S4zWz vMz7CMK1Y8wGd6BiuN3E/vokkLaKD4tV0x+/cRvS1F/eBWUILWgr1Qb+PokqTrK5XKdN rCHplQYn8EpgGXyjWBibP8RiHorZha7yc1V0tiGR6D4B7kpuMUtwrz27NMV1jLp89S4f 9LfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id r25si6975149qtr.142.2017.08.14.10.01.28; Mon, 14 Aug 2017 10:01:28 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 448EA60CFC; Mon, 14 Aug 2017 17:01:28 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED 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 CC982644A0; Mon, 14 Aug 2017 17:00:35 +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 C727164496; Mon, 14 Aug 2017 17:00:27 +0000 (UTC) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [37.140.190.182]) by lists.linaro.org (Postfix) with ESMTPS id 7421564469 for ; Mon, 14 Aug 2017 17:00:23 +0000 (UTC) Received: from mxback8g.mail.yandex.net (mxback8g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:169]) by forward102o.mail.yandex.net (Yandex) with ESMTP id 658705A01848 for ; Mon, 14 Aug 2017 20:00:22 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback8g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id KeHL6XyRlE-0MmiEJop; Mon, 14 Aug 2017 20:00:22 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id mlYyN0Wfya-0LoS7tUP; Mon, 14 Aug 2017 20:00:21 +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: Mon, 14 Aug 2017 20:00:05 +0300 Message-Id: <1502730005-8444-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502730005-8444-1-git-send-email-odpbot@yandex.ru> References: <1502730005-8444-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 126 Subject: [lng-odp] [PATCH v1 3/3] validation: classification: add test case for classifier enable boolean 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: Balasubramanian Manoharan updates test suite to enable classifier in odp_pktin_queue_param_t config adds test case for classifier enable boolean Fixes https://bugs.linaro.org/show_bug.cgi?id=3177 Signed-off-by: Balasubramanian Manoharan Signed-off-by: Maxim Uvarov --- /** Email created from pull request 126 (muvarov:monarch_lts) ** https://github.com/Linaro/odp/pull/126 ** Patch: https://github.com/Linaro/odp/pull/126.patch ** Base sha: 759b6d5da6617af244765983d0b8bfbb26f41890 ** Merge commit sha: 2c095e7e4fe1c0fc39b552b84d2374988f5920ca **/ test/validation/classification/classification.h | 1 + .../classification/odp_classification_basic.c | 4 +- .../classification/odp_classification_common.c | 5 +- .../classification/odp_classification_test_pmr.c | 118 +++++++++++++++++++-- .../classification/odp_classification_tests.c | 2 + .../classification/odp_classification_testsuites.h | 3 +- 6 files changed, 119 insertions(+), 14 deletions(-) diff --git a/test/validation/classification/classification.h b/test/validation/classification/classification.h index d73c8216..629484d0 100644 --- a/test/validation/classification/classification.h +++ b/test/validation/classification/classification.h @@ -77,6 +77,7 @@ void classification_test_pmr_term_udp_sport(void); void classification_test_pmr_term_ipproto(void); void classification_test_pmr_term_dmac(void); void classification_test_pmr_term_packet_len(void); +void classification_test_pktin_classifier_flag(void); /* test arrays: */ extern odp_testinfo_t classification_suite_basic[]; diff --git a/test/validation/classification/odp_classification_basic.c b/test/validation/classification/odp_classification_basic.c index 372377d8..9e83fc3d 100644 --- a/test/validation/classification/odp_classification_basic.c +++ b/test/validation/classification/odp_classification_basic.c @@ -89,7 +89,7 @@ void classification_test_create_pmr_match(void) pkt_pool = pool_create("pkt_pool"); CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID); - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); configure_default_cos(pktio, &default_cos, @@ -273,7 +273,7 @@ void classification_test_pmr_composite_create(void) pkt_pool = pool_create("pkt_pool"); CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID); - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); configure_default_cos(pktio, &default_cos, diff --git a/test/validation/classification/odp_classification_common.c b/test/validation/classification/odp_classification_common.c index 7a42ac74..e0012cdc 100644 --- a/test/validation/classification/odp_classification_common.c +++ b/test/validation/classification/odp_classification_common.c @@ -17,7 +17,8 @@ typedef struct cls_test_packet { odp_u32be_t seq; } cls_test_packet_t; -odp_pktio_t create_pktio(odp_queue_type_t q_type, odp_pool_t pool) +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; @@ -43,6 +44,8 @@ odp_pktio_t create_pktio(odp_queue_type_t q_type, odp_pool_t pool) 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"); diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c index 7c7d07ea..c9c0fe39 100644 --- a/test/validation/classification/odp_classification_test_pmr.c +++ b/test/validation/classification/odp_classification_test_pmr.c @@ -85,6 +85,102 @@ int classification_suite_pmr_term(void) return retcode; } +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(pkt_pool, false, &seq, true); + 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); +} + void classification_test_pmr_term_tcp_dport(void) { odp_packet_t pkt; @@ -113,7 +209,7 @@ void classification_test_pmr_term_tcp_dport(void) mask = 0xffff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + 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); @@ -227,7 +323,7 @@ void classification_test_pmr_term_tcp_sport(void) mask = 0xffff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + 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); @@ -339,7 +435,7 @@ void classification_test_pmr_term_udp_dport(void) mask = 0xffff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + 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); @@ -452,7 +548,7 @@ void classification_test_pmr_term_udp_sport(void) mask = 0xffff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + 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); @@ -563,7 +659,7 @@ void classification_test_pmr_term_ipproto(void) mask = 0xff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + 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); @@ -669,7 +765,7 @@ void classification_test_pmr_term_dmac(void) mask = 0xffffffffffff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + 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); @@ -772,7 +868,7 @@ void classification_test_pmr_term_packet_len(void) mask = 0xff00; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + 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); @@ -880,7 +976,7 @@ static void classification_test_pmr_pool_set(void) mask = 0xff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + 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); @@ -976,7 +1072,7 @@ static void classification_test_pmr_queue_set(void) mask = 0xff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + 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); @@ -1068,7 +1164,8 @@ static void classification_test_pmr_term_daddr(void) const char *dst_addr = "10.0.0.99/32"; odph_ethhdr_t *eth; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + 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); @@ -1159,5 +1256,6 @@ odp_testinfo_t classification_suite_pmr[] = { ODP_TEST_INFO(classification_test_pmr_queue_set), ODP_TEST_INFO(classification_test_pmr_term_daddr), ODP_TEST_INFO(classification_test_pmr_term_packet_len), + ODP_TEST_INFO(classification_test_pktin_classifier_flag), ODP_TEST_INFO_NULL, }; diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index ed45518b..85f422dc 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -49,6 +49,8 @@ int classification_suite_init(void) 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"); diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h index aea3de1b..1f3e084b 100644 --- a/test/validation/classification/odp_classification_testsuites.h +++ b/test/validation/classification/odp_classification_testsuites.h @@ -28,7 +28,8 @@ odp_packet_t create_packet_len(odp_pool_t pool, bool vlan, uint16_t len); 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_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);