From patchwork Mon Apr 25 14:20:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 66588 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1067718qge; Mon, 25 Apr 2016 07:24:38 -0700 (PDT) X-Received: by 10.55.66.66 with SMTP id p63mr18004797qka.137.1461594278093; Mon, 25 Apr 2016 07:24:38 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a202si10674036qkc.132.2016.04.25.07.24.37; Mon, 25 Apr 2016 07:24:38 -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=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id A49BD61887; Mon, 25 Apr 2016 14:24:37 +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, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 7320061610; Mon, 25 Apr 2016 14:23:06 +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 2121F618C2; Mon, 25 Apr 2016 14:22:34 +0000 (UTC) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by lists.linaro.org (Postfix) with ESMTPS id 5DC766187B for ; Mon, 25 Apr 2016 14:21:34 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bt5so11590510pac.3 for ; Mon, 25 Apr 2016 07:21:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TG0FuPWr0GZTL9cZKYZkRSaYzZ1pxGsjXbRuQoHvIqE=; b=GkQBMP7oujzFSmQ8SF3eCXPQ/EtFZRn2AHwRslHQEuIiI64TPdlN06NzR442kUsx9r WIHMdQZYQY3bdiAwGd2lOeWfxq8jcyVEpk23tjkbVO+XWusXw1PYezPB94iAvvvLArqY eRqmQ6xHzDuQwxL2EtWh2XKrOdCvTkUaLmfQorhSvXjwcS8AgtpeqRKz/RswgnS4iSoC RQnBSmOD05pRzJOdqwmAnTq0RLalag2SMcrPIT2vIPbD6p0djbSXkGsZFFDyjh2+i3Cs 7UEzJuQeSRrdC4BKBjewNttkQpRez9EMSh9c9DdgHhNrVKuJ/mXnj1S4EOasnWchs+i9 Y/zQ== X-Gm-Message-State: AOPr4FUyaruGk0DdX/Ao3VS2kg6jGRswTWZz8QAb33SIvxwk6ac5Ax4kYzNQax0x5uLDQFQP56Y= X-Received: by 10.66.141.42 with SMTP id rl10mr49554221pab.48.1461594093638; Mon, 25 Apr 2016 07:21:33 -0700 (PDT) Received: from localhost.localdomain ([106.206.145.44]) by smtp.gmail.com with ESMTPSA id q26sm29251069pfi.57.2016.04.25.07.21.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Apr 2016 07:21:32 -0700 (PDT) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Mon, 25 Apr 2016 19:50:58 +0530 Message-Id: <1461594059-23824-3-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461594059-23824-1-git-send-email-bala.manoharan@linaro.org> References: <1461594059-23824-1-git-send-email-bala.manoharan@linaro.org> X-Topics: Classification Cc: petri.savolainen@nokia.com Subject: [lng-odp] [API-NEXTv3 3/4] validation: classification: incorporates capability and PMR range 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Adds validation suite for classification capability and PMR range Signed-off-by: Balasubramanian Manoharan Reviewed-by: Bill Fischofer --- test/validation/classification/classification.h | 2 - .../classification/odp_classification_basic.c | 24 ++-- .../classification/odp_classification_common.c | 19 +-- .../classification/odp_classification_test_pmr.c | 127 +++++++++++---------- .../classification/odp_classification_tests.c | 85 ++++++-------- .../classification/odp_classification_testsuites.h | 2 +- 6 files changed, 129 insertions(+), 130 deletions(-) diff --git a/test/validation/classification/classification.h b/test/validation/classification/classification.h index 8645ea5..1c442ce 100644 --- a/test/validation/classification/classification.h +++ b/test/validation/classification/classification.h @@ -67,8 +67,6 @@ void classification_test_pmr_composite_destroy(void); void classification_test_pktio_set_skip(void); void classification_test_pktio_set_headroom(void); -void classification_test_pmr_terms_avail(void); -void classification_test_pmr_terms_cap(void); void classification_test_pktio_configure(void); void classification_test_pktio_test(void); diff --git a/test/validation/classification/odp_classification_basic.c b/test/validation/classification/odp_classification_basic.c index 0ad6581..372377d 100644 --- a/test/validation/classification/odp_classification_basic.c +++ b/test/validation/classification/odp_classification_basic.c @@ -75,7 +75,7 @@ void classification_test_create_pmr_match(void) uint16_t val; uint16_t mask; int retval; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odp_cos_t default_cos; odp_cos_t cos; odp_queue_t default_queue; @@ -111,12 +111,14 @@ void classification_test_create_pmr_match(void) val = 1024; mask = 0xffff; - match.term = find_first_supported_l3_pmr(); - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); - - pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); + 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 */ @@ -254,7 +256,7 @@ void classification_test_pmr_composite_create(void) { odp_pmr_t pmr_composite; int retval; - odp_pmr_match_t pmr_terms[PMR_SET_NUM]; + odp_pmr_param_t pmr_terms[PMR_SET_NUM]; odp_cos_t default_cos; odp_cos_t cos; odp_queue_t default_queue; @@ -292,9 +294,11 @@ void classification_test_pmr_composite_create(void) 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].val = &val; - pmr_terms[i].mask = &mask; + 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); } diff --git a/test/validation/classification/odp_classification_common.c b/test/validation/classification/odp_classification_common.c index e06d0a9..09ec191 100644 --- a/test/validation/classification/odp_classification_common.c +++ b/test/validation/classification/odp_classification_common.c @@ -338,20 +338,21 @@ odp_packet_t create_packet_len(odp_pool_t pool, bool vlan, return pkt; } -odp_pmr_term_t find_first_supported_l3_pmr(void) +odp_cls_pmr_term_t find_first_supported_l3_pmr(void) { - unsigned long long cap; - odp_pmr_term_t term = ODP_PMR_TCP_DPORT; + odp_cls_pmr_term_t term = ODP_PMR_TCP_DPORT; + odp_cls_capability_t capability; + + odp_cls_capability(&capability); /* choose supported PMR */ - cap = odp_pmr_terms_cap(); - if (cap & (1 << ODP_PMR_UDP_SPORT)) + if (capability.supported_terms.bit.udp_sport) term = ODP_PMR_UDP_SPORT; - else if (cap & (1 << ODP_PMR_UDP_DPORT)) + else if (capability.supported_terms.bit.udp_dport) term = ODP_PMR_UDP_DPORT; - else if (cap & (1 << ODP_PMR_TCP_SPORT)) + else if (capability.supported_terms.bit.tcp_sport) term = ODP_PMR_TCP_SPORT; - else if (cap & (1 << ODP_PMR_TCP_DPORT)) + else if (capability.supported_terms.bit.tcp_dport) term = ODP_PMR_TCP_DPORT; else CU_FAIL("Implementations doesn't support any TCP/UDP PMR"); @@ -363,7 +364,7 @@ int set_first_supported_pmr_port(odp_packet_t pkt, uint16_t port) { odph_udphdr_t *udp; odph_tcphdr_t *tcp; - odp_pmr_term_t term; + 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); diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c index e5f9f51..344503a 100644 --- a/test/validation/classification/odp_classification_test_pmr.c +++ b/test/validation/classification/odp_classification_test_pmr.c @@ -106,7 +106,7 @@ void classification_test_pmr_term_tcp_dport(void) odp_cls_cos_param_t cls_param; odp_pool_t pool; odp_pool_t pool_recv; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odph_ethhdr_t *eth; val = CLS_DEFAULT_DPORT; @@ -136,12 +136,13 @@ void classification_test_pmr_term_tcp_dport(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT(cos != ODP_COS_INVALID); - match.term = ODP_PMR_TCP_DPORT; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); + 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(&match, 1, default_cos, cos); + pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); CU_ASSERT(pmr != ODP_PMR_INVAL); pkt = create_packet(pkt_pool, false, &seq, false); @@ -219,7 +220,7 @@ void classification_test_pmr_term_tcp_sport(void) odp_cos_t cos; char cosname[ODP_COS_NAME_LEN]; odp_cls_cos_param_t cls_param; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odph_ethhdr_t *eth; val = CLS_DEFAULT_SPORT; @@ -249,12 +250,12 @@ void classification_test_pmr_term_tcp_sport(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - match.term = ODP_PMR_TCP_SPORT; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); + 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(&match, 1, default_cos, cos); + pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); CU_ASSERT(pmr != ODP_PMR_INVAL); pkt = create_packet(pkt_pool, false, &seq, false); @@ -329,7 +330,7 @@ void classification_test_pmr_term_udp_dport(void) odp_pmr_t pmr; odp_cos_t cos; char cosname[ODP_COS_NAME_LEN]; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odp_cls_cos_param_t cls_param; odph_ethhdr_t *eth; @@ -360,12 +361,13 @@ void classification_test_pmr_term_udp_dport(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - match.term = ODP_PMR_UDP_DPORT; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); + 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(&match, 1, default_cos, cos); + 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); @@ -441,7 +443,7 @@ void classification_test_pmr_term_udp_sport(void) odp_pmr_t pmr; odp_cos_t cos; char cosname[ODP_COS_NAME_LEN]; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odp_cls_cos_param_t cls_param; odph_ethhdr_t *eth; @@ -472,12 +474,12 @@ void classification_test_pmr_term_udp_sport(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - match.term = ODP_PMR_UDP_SPORT; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); + 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(&match, 1, default_cos, cos); + 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); @@ -552,7 +554,7 @@ void classification_test_pmr_term_ipproto(void) odp_cos_t cos; char cosname[ODP_COS_NAME_LEN]; odp_cls_cos_param_t cls_param; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odph_ethhdr_t *eth; val = ODPH_IPPROTO_UDP; @@ -582,12 +584,13 @@ void classification_test_pmr_term_ipproto(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - match.term = ODP_PMR_IPPROTO; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); + 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(&match, 1, default_cos, cos); + 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); @@ -657,7 +660,7 @@ void classification_test_pmr_term_dmac(void) odp_cos_t cos; char cosname[ODP_COS_NAME_LEN]; odp_cls_cos_param_t cls_param; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odph_ethhdr_t *eth; val = CLS_DEFAULT_DMAC; /* 48 bit Ethernet Mac address */ @@ -687,12 +690,12 @@ void classification_test_pmr_term_dmac(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - match.term = ODP_PMR_DMAC; - match.val = &val; - match.mask = &mask; - match.val_sz = ODPH_ETHADDR_LEN; + 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(&match, 1, default_cos, cos); + 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); @@ -758,7 +761,7 @@ void classification_test_pmr_term_packet_len(void) odp_cos_t cos; char cosname[ODP_COS_NAME_LEN]; odp_cls_cos_param_t cls_param; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odph_ethhdr_t *eth; val = 1024; @@ -789,12 +792,13 @@ void classification_test_pmr_term_packet_len(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - match.term = ODP_PMR_LEN; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); + 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(&match, 1, default_cos, cos); + pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); CU_ASSERT(pmr != ODP_PMR_INVAL); /* create packet of payload length 1024 */ @@ -866,7 +870,7 @@ static void classification_test_pmr_pool_set(void) odp_cos_t cos; char cosname[ODP_COS_NAME_LEN]; odp_cls_cos_param_t cls_param; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odph_ethhdr_t *eth; val = ODPH_IPPROTO_UDP; @@ -903,12 +907,13 @@ static void classification_test_pmr_pool_set(void) retval = odp_cls_cos_pool_set(cos, pool_new); CU_ASSERT(retval == 0); - match.term = ODP_PMR_IPPROTO; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); + 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(&match, 1, default_cos, cos); + 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); @@ -961,7 +966,7 @@ static void classification_test_pmr_queue_set(void) odp_cos_t cos; char cosname[ODP_COS_NAME_LEN]; odp_cls_cos_param_t cls_param; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odph_ethhdr_t *eth; val = ODPH_IPPROTO_UDP; @@ -998,12 +1003,13 @@ static void classification_test_pmr_queue_set(void) retval = odp_cos_queue_set(cos, queue_new); CU_ASSERT(retval == 0); - match.term = ODP_PMR_IPPROTO; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); + 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(&match, 1, default_cos, cos); + 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); @@ -1053,7 +1059,7 @@ static void classification_test_pmr_term_daddr(void) uint32_t addr; uint32_t mask; char cosname[ODP_QUEUE_NAME_LEN]; - odp_pmr_match_t match; + 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"; @@ -1082,12 +1088,13 @@ static void classification_test_pmr_term_daddr(void) CU_ASSERT_FATAL(cos != ODP_COS_INVALID); parse_ipv4_string(dst_addr, &addr, &mask); - match.term = ODP_PMR_DIP_ADDR; - match.val = &addr; - match.mask = &mask; - match.val_sz = sizeof(addr); + 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(&match, 1, default_cos, cos); + 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 diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index b1e53ec..f33a2a6 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -135,7 +135,7 @@ void configure_cls_pmr_chain(void) char poolname[ODP_POOL_NAME_LEN]; uint32_t addr; uint32_t mask; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odp_queue_param_init(&qparam); @@ -159,6 +159,7 @@ void configure_cls_pmr_chain(void) 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); @@ -186,23 +187,25 @@ void configure_cls_pmr_chain(void) CU_ASSERT_FATAL(cos_list[CLS_PMR_CHAIN_DST] != ODP_COS_INVALID); parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask); - match.term = ODP_PMR_SIP_ADDR; - match.val = &addr; - match.mask = &mask; - match.val_sz = sizeof(addr); + 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(&match, 1, cos_list[CLS_DEFAULT], + 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; - match.term = find_first_supported_l3_pmr(); - match.val = &val; - match.mask = &maskport; - match.val_sz = sizeof(val); + 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(&match, 1, cos_list[CLS_PMR_CHAIN_SRC], + 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); } @@ -495,7 +498,7 @@ void configure_pmr_cos(void) { uint16_t val; uint16_t mask; - odp_pmr_match_t match; + odp_pmr_param_t pmr_param; odp_queue_param_t qparam; odp_cls_cos_param_t cls_param; char cosname[ODP_COS_NAME_LEN]; @@ -526,12 +529,14 @@ void configure_pmr_cos(void) val = CLS_PMR_PORT; mask = 0xffff; - match.term = find_first_supported_l3_pmr(); - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); - - pmr_list[CLS_PMR] = odp_cls_pmr_create(&match, 1, cos_list[CLS_DEFAULT], + 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); } @@ -560,7 +565,7 @@ void test_pmr_cos(void) void configure_pktio_pmr_composite(void) { - odp_pmr_match_t pmr_terms[2]; + odp_pmr_param_t pmr_params[2]; uint16_t val; uint16_t maskport; int num_terms = 2; /* one pmr for each L3 and L4 */ @@ -595,19 +600,22 @@ void configure_pktio_pmr_composite(void) CU_ASSERT_FATAL(cos_list[CLS_PMR_SET] != ODP_COS_INVALID); parse_ipv4_string(CLS_PMR_SET_SADDR, &addr, &mask); - pmr_terms[0].term = ODP_PMR_SIP_ADDR; - pmr_terms[0].val = &addr; - pmr_terms[0].mask = &mask; - pmr_terms[0].val_sz = sizeof(addr); + 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; - pmr_terms[1].term = find_first_supported_l3_pmr(); - pmr_terms[1].val = &val; - pmr_terms[1].mask = &maskport; - pmr_terms[1].val_sz = sizeof(val); - - pmr_list[CLS_PMR_SET] = odp_cls_pmr_create(pmr_terms, num_terms, + 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); @@ -645,23 +653,6 @@ void test_pktio_pmr_composite_cos(void) odp_packet_free(pkt); } -void classification_test_pmr_terms_avail(void) -{ - int retval; - /* Since this API called at the start of the suite the return value - should be greater than 0 */ - retval = odp_pmr_terms_avail(); - CU_ASSERT(retval > 0); -} - -void classification_test_pmr_terms_cap(void) -{ - unsigned long long retval; - /* Need to check different values for different platforms */ - retval = odp_pmr_terms_cap(); - CU_ASSERT(retval & (1 << ODP_PMR_IPPROTO)); -} - void classification_test_pktio_configure(void) { /* Configure the Different CoS for the pktio interface */ @@ -697,10 +688,8 @@ void classification_test_pktio_test(void) } odp_testinfo_t classification_suite[] = { - ODP_TEST_INFO(classification_test_pmr_terms_avail), ODP_TEST_INFO(classification_test_pktio_set_skip), ODP_TEST_INFO(classification_test_pktio_set_headroom), - ODP_TEST_INFO(classification_test_pmr_terms_cap), ODP_TEST_INFO(classification_test_pktio_configure), ODP_TEST_INFO(classification_test_pktio_test), ODP_TEST_INFO_NULL, diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h index f75fc95..023a267 100644 --- a/test/validation/classification/odp_classification_testsuites.h +++ b/test/validation/classification/odp_classification_testsuites.h @@ -48,7 +48,7 @@ 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_pmr_term_t find_first_supported_l3_pmr(void); +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_ */