From patchwork Fri Apr 22 17:29:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 66491 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp847036qge; Fri, 22 Apr 2016 10:32:30 -0700 (PDT) X-Received: by 10.50.93.42 with SMTP id cr10mr5894722igb.24.1461346350749; Fri, 22 Apr 2016 10:32:30 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id mx2si5284505igb.13.2016.04.22.10.32.27; Fri, 22 Apr 2016 10:32:30 -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 BEF0267431; Fri, 22 Apr 2016 17:32:26 +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_H2, 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 1D1296886B; Fri, 22 Apr 2016 17:31:12 +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 3818068509; Fri, 22 Apr 2016 17:31:01 +0000 (UTC) Received: from mail-pf0-f174.google.com (mail-pf0-f174.google.com [209.85.192.174]) by lists.linaro.org (Postfix) with ESMTPS id 3D1F76742F for ; Fri, 22 Apr 2016 17:30:19 +0000 (UTC) Received: by mail-pf0-f174.google.com with SMTP id y69so24771209pfb.1 for ; Fri, 22 Apr 2016 10:30:19 -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=EZcKSXJcyDl2J6tj9zHOKOcmEtqElHRcm+IrMdGqM4c=; b=LS4eG+z9Mu5JBJnzbmzUqajeJBQk0xa9aDwXC4J4luIhTgLKOMRoOLnV5yvkmv3kiO KD8YDspKpyojXhFtFJVR4DgSRIoE316HGvOYlZ/WIwhZiyGlD1Q8D934jtE+oTi2683J koX3B++l/yXHa2iSfKHZF8mIUfO66W8+AETL4klVS8jjMzT07tL/KGEZ9f9RqjVo/gOX qZLMEuC01UCrC7s5OXhjLTqdZlHRFDv5eybmEE8BpMZKZG/BU4du1GnILjEpJkr2tNnh GYruMGF0BoGicXrdev2KI+8efG6DtDQx9G4YKEs3ADYKL1ZRbnkoW4R8oZPumvZHvNkD SmvA== X-Gm-Message-State: AOPr4FVDaT8VztAFqXi6CXf5F0TM0hq3ucoNKQHzqiG0RKtLrnJpi5yWt26UJ5puDfYRZe6cgJg= X-Received: by 10.98.12.213 with SMTP id 82mr3695848pfm.90.1461346218521; Fri, 22 Apr 2016 10:30:18 -0700 (PDT) Received: from bala-Vostro-2520.domain.name ([117.199.134.57]) by smtp.gmail.com with ESMTPSA id r17sm9744909pfj.39.2016.04.22.10.30.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Apr 2016 10:30:17 -0700 (PDT) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Fri, 22 Apr 2016 22:59:53 +0530 Message-Id: <1461346194-16534-3-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461346194-16534-1-git-send-email-bala.manoharan@linaro.org> References: <1461346194-16534-1-git-send-email-bala.manoharan@linaro.org> X-Topics: Classification Cc: petri.savolainen@nokia.com Subject: [lng-odp] [API-NEXTv2 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 --- 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..8c6eefe 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_e find_first_supported_l3_pmr(void) { - unsigned long long cap; - odp_pmr_term_t term = ODP_PMR_TCP_DPORT; + odp_cls_pmr_term_e 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_e 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..194f105 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_e find_first_supported_l3_pmr(void); int set_first_supported_pmr_port(odp_packet_t pkt, uint16_t port); #endif /* ODP_BUFFER_TESTSUITES_H_ */