From patchwork Thu Apr 21 06:19:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 66309 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2860513qge; Wed, 20 Apr 2016 23:21:33 -0700 (PDT) X-Received: by 10.140.23.18 with SMTP id 18mr15315117qgo.91.1461219693764; Wed, 20 Apr 2016 23:21:33 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e189si618992qkd.257.2016.04.20.23.21.33; Wed, 20 Apr 2016 23:21:33 -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 60284673EF; Thu, 21 Apr 2016 06:21:33 +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=-0.5 required=5.0 tests=BAYES_00, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_WEB, 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 192A668A6E; Thu, 21 Apr 2016 06:20:21 +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 1012F673A1; Thu, 21 Apr 2016 06:20:07 +0000 (UTC) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by lists.linaro.org (Postfix) with ESMTPS id 96DD8673A1 for ; Thu, 21 Apr 2016 06:19:30 +0000 (UTC) Received: by mail-pa0-f47.google.com with SMTP id r5so23335628pag.1 for ; Wed, 20 Apr 2016 23:19:30 -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=478t6hgzM5SB3tMyFSuHefLcP6gLOLOp6Ivf0pQpKLg=; b=TQOxhHKDDLDpxaQ3633o2g+kP4djIv7jzsEDpHcXsxoWW5/OIrPJK0ctS2t8hGI3D/ neLs8juQ4LTDhGdaE0XFtIpyiupxw7XJX5R/L6gR6MTzPec9RO73pdk0CgiUcRgMQmsU A3dC5IjmitJOO7PAGpLlaRThJlvgsV724BsWJVOanCJhQRJbkoxUxH0rvnV5knwQnRq1 yJDcy9QJJ6v9gTOO+59tt0kkO7uGOXj6F19WXxlS4eGTg4/7JTCdnz73+9s8jwTAtWJT 0TDP0j2BtUv25GUfTh6gOPPJAYCl4aBERHZJkwtFyuKr7VBzHyVd3eDAP3lojauMPqL8 wfBA== X-Gm-Message-State: AOPr4FUitUbgdDIL9HHkoAFmW2W0mFWfMLkWi5fmnZSl4GhFbYuB+HxnM4i/weF9J06/HYu7iUU= X-Received: by 10.67.2.41 with SMTP id bl9mr18000388pad.39.1461219569916; Wed, 20 Apr 2016 23:19:29 -0700 (PDT) Received: from localhost.localdomain ([111.93.218.67]) by smtp.gmail.com with ESMTPSA id v189sm1722577pfb.85.2016.04.20.23.19.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Apr 2016 23:19:29 -0700 (PDT) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Thu, 21 Apr 2016 11:49:04 +0530 Message-Id: <1461219545-14545-3-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461219545-14545-1-git-send-email-bala.manoharan@linaro.org> References: <1461219545-14545-1-git-send-email-bala.manoharan@linaro.org> X-Topics: Classification Cc: petri.savolainen@nokia.com Subject: [lng-odp] [API-NEXT 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 functionality. Signed-off-by: Balasubramanian Manoharan --- test/validation/classification/classification.h | 2 - .../classification/odp_classification_basic.c | 24 ++-- .../classification/odp_classification_common.c | 13 ++- .../classification/odp_classification_test_pmr.c | 127 +++++++++++---------- .../classification/odp_classification_tests.c | 85 ++++++-------- 5 files changed, 125 insertions(+), 126 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..a6b73c8 100644 --- a/test/validation/classification/odp_classification_common.c +++ b/test/validation/classification/odp_classification_common.c @@ -340,18 +340,19 @@ odp_packet_t create_packet_len(odp_pool_t pool, bool vlan, odp_pmr_term_t find_first_supported_l3_pmr(void) { - unsigned long long cap; odp_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.pmr_terms.proto.udp_sport) term = ODP_PMR_UDP_SPORT; - else if (cap & (1 << ODP_PMR_UDP_DPORT)) + else if (capability.pmr_terms.proto.udp_dport) term = ODP_PMR_UDP_DPORT; - else if (cap & (1 << ODP_PMR_TCP_SPORT)) + else if (capability.pmr_terms.proto.tcp_sport) term = ODP_PMR_TCP_SPORT; - else if (cap & (1 << ODP_PMR_TCP_DPORT)) + else if (capability.pmr_terms.proto.tcp_dport) term = ODP_PMR_TCP_DPORT; else CU_FAIL("Implementations doesn't support any TCP/UDP PMR"); 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,