Message ID | 1454422054-22226-3-git-send-email-bala.manoharan@linaro.org |
---|---|
State | Superseded |
Headers | show |
Part 3 of this patch fails to apply to the head of api-next for me: bill@Ubuntu15:~/linaro/balapmr$ git am --reject ~/Mail/Incoming/Bala/7 Applying: validation: classification: adds validation suite for pmr create api Checking patch test/validation/classification/classification.h... Checking patch test/validation/classification/odp_classification_basic.c... Checking patch test/validation/classification/odp_classification_common.c... Checking patch test/validation/classification/odp_classification_test_pmr.c... error: while searching for: return 0; } odp_pktio_t create_pktio(odp_queue_type_t q_type) { odp_pktio_t pktio; odp_pktio_param_t pktio_param; int ret; if (pkt_pool == ODP_POOL_INVALID) return ODP_PKTIO_INVALID; odp_pktio_param_init(&pktio_param); if (q_type == ODP_QUEUE_TYPE_POLL) pktio_param.in_mode = ODP_PKTIN_MODE_POLL; else pktio_param.in_mode = ODP_PKTIN_MODE_SCHED; pktio = odp_pktio_open("loop", pkt_pool, &pktio_param); if (pktio == ODP_PKTIO_INVALID) { ret = odp_pool_destroy(pkt_pool); if (ret) fprintf(stderr, "unable to destroy pool.\n"); return ODP_PKTIO_INVALID; } return pktio; } int create_default_inq(odp_pktio_t pktio, odp_queue_type_t qtype) { odp_queue_param_t qparam; error: patch failed: test/validation/classification/odp_classification_test_pmr.c:29 Hunk #2 succeeded at 161 (offset 25 lines). Hunk #3 succeeded at 169 (offset 25 lines). Hunk #4 succeeded at 184 (offset 25 lines). Hunk #5 succeeded at 238 (offset 25 lines). Hunk #6 succeeded at 274 (offset 25 lines). Hunk #7 succeeded at 282 (offset 25 lines). Hunk #8 succeeded at 297 (offset 25 lines). Hunk #9 succeeded at 349 (offset 25 lines). Hunk #10 succeeded at 385 (offset 25 lines). Hunk #11 succeeded at 393 (offset 25 lines). Hunk #12 succeeded at 408 (offset 25 lines). Hunk #13 succeeded at 461 (offset 25 lines). Hunk #14 succeeded at 497 (offset 25 lines). Hunk #15 succeeded at 505 (offset 25 lines). Hunk #16 succeeded at 520 (offset 25 lines). Hunk #17 succeeded at 572 (offset 25 lines). Hunk #18 succeeded at 607 (offset 25 lines). Hunk #19 succeeded at 615 (offset 25 lines). Hunk #20 succeeded at 630 (offset 25 lines). Hunk #21 succeeded at 676 (offset 25 lines). Hunk #22 succeeded at 712 (offset 25 lines). Hunk #23 succeeded at 720 (offset 25 lines). Hunk #24 succeeded at 735 (offset 25 lines). Hunk #25 succeeded at 777 (offset 25 lines). Hunk #26 succeeded at 814 (offset 25 lines). Hunk #27 succeeded at 822 (offset 25 lines). Hunk #28 succeeded at 837 (offset 25 lines). Hunk #29 succeeded at 884 (offset 25 lines). Hunk #30 succeeded at 921 (offset 25 lines). Hunk #31 succeeded at 929 (offset 25 lines). Hunk #32 succeeded at 951 (offset 25 lines). Hunk #33 succeeded at 979 (offset 25 lines). Hunk #34 succeeded at 1016 (offset 25 lines). Hunk #35 succeeded at 1024 (offset 25 lines). Hunk #36 succeeded at 1046 (offset 25 lines). Hunk #37 succeeded at 1074 (offset 25 lines). Hunk #38 succeeded at 1107 (offset 25 lines). Hunk #39 succeeded at 1129 (offset 25 lines). Hunk #40 succeeded at 1176 (offset 25 lines). Checking patch test/validation/classification/odp_classification_tests.c... Hunk #4 succeeded at 189 (offset -2 lines). Hunk #5 succeeded at 200 (offset -2 lines). Hunk #6 succeeded at 494 (offset -3 lines). error: while searching for: char queuename[ODP_QUEUE_NAME_LEN]; char poolname[ODP_POOL_NAME_LEN]; 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_pmr_create(&match); CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); odp_queue_param_init(&qparam); qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; qparam.sched.sync = ODP_SCHED_SYNC_NONE; error: patch failed: test/validation/classification/odp_classification_tests.c:512 Hunk #8 succeeded at 533 (offset 6 lines). Hunk #9 succeeded at 567 (offset 6 lines). error: while searching for: uint32_t addr = 0; uint32_t mask; 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); 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); retval = odp_pmr_match_set_create(num_terms, pmr_terms, &pmr_set); CU_ASSERT(retval > 0); odp_queue_param_init(&qparam); qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; qparam.sched.sync = ODP_SCHED_SYNC_NONE; error: patch failed: test/validation/classification/odp_classification_tests.c:587 Hunk #11 succeeded at 620 (offset 22 lines). Hunk #12 succeeded at 702 (offset 22 lines). Checking patch test/validation/classification/odp_classification_testsuites.h... Applied patch test/validation/classification/classification.h cleanly. Applied patch test/validation/classification/odp_classification_basic.c cleanly. Applied patch test/validation/classification/odp_classification_common.c cleanly. Applying patch test/validation/classification/odp_classification_test_pmr.c with 1 reject... Rejected hunk #1. Hunk #2 applied cleanly. Hunk #3 applied cleanly. Hunk #4 applied cleanly. Hunk #5 applied cleanly. Hunk #6 applied cleanly. Hunk #7 applied cleanly. Hunk #8 applied cleanly. Hunk #9 applied cleanly. Hunk #10 applied cleanly. Hunk #11 applied cleanly. Hunk #12 applied cleanly. Hunk #13 applied cleanly. Hunk #14 applied cleanly. Hunk #15 applied cleanly. Hunk #16 applied cleanly. Hunk #17 applied cleanly. Hunk #18 applied cleanly. Hunk #19 applied cleanly. Hunk #20 applied cleanly. Hunk #21 applied cleanly. Hunk #22 applied cleanly. Hunk #23 applied cleanly. Hunk #24 applied cleanly. Hunk #25 applied cleanly. Hunk #26 applied cleanly. Hunk #27 applied cleanly. Hunk #28 applied cleanly. Hunk #29 applied cleanly. Hunk #30 applied cleanly. Hunk #31 applied cleanly. Hunk #32 applied cleanly. Hunk #33 applied cleanly. Hunk #34 applied cleanly. Hunk #35 applied cleanly. Hunk #36 applied cleanly. Hunk #37 applied cleanly. Hunk #38 applied cleanly. Hunk #39 applied cleanly. Hunk #40 applied cleanly. Applying patch test/validation/classification/odp_classification_tests.c with 2 rejects... Hunk #1 applied cleanly. Hunk #2 applied cleanly. Hunk #3 applied cleanly. Hunk #4 applied cleanly. Hunk #5 applied cleanly. Hunk #6 applied cleanly. Rejected hunk #7. Hunk #8 applied cleanly. Hunk #9 applied cleanly. Rejected hunk #10. Hunk #11 applied cleanly. Hunk #12 applied cleanly. Applied patch test/validation/classification/odp_classification_testsuites.h cleanly. Patch failed at 0001 validation: classification: adds validation suite for pmr create api The copy of the patch that failed is found in: /home/bill/linaro/balapmr/.git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". On Tue, Feb 2, 2016 at 8:07 AM, Balasubramanian Manoharan < bala.manoharan@linaro.org> wrote: > Adds validation suite for packet match rule create functions. > > Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> > --- > test/validation/classification/classification.h | 1 - > .../classification/odp_classification_basic.c | 141 +++++++----- > .../classification/odp_classification_common.c | 26 +++ > .../classification/odp_classification_test_pmr.c | 239 > ++++++++------------- > .../classification/odp_classification_tests.c | 87 ++++---- > .../classification/odp_classification_testsuites.h | 4 +- > 6 files changed, 245 insertions(+), 253 deletions(-) > > diff --git a/test/validation/classification/classification.h > b/test/validation/classification/classification.h > index 5508af7..c987cca 100644 > --- a/test/validation/classification/classification.h > +++ b/test/validation/classification/classification.h > @@ -59,7 +59,6 @@ > void classification_test_create_cos(void); > void classification_test_destroy_cos(void); > void classification_test_create_pmr_match(void); > -void classification_test_destroy_pmr(void); > void classification_test_cos_set_queue(void); > void classification_test_cos_set_pool(void); > void classification_test_cos_set_drop(void); > diff --git a/test/validation/classification/odp_classification_basic.c > b/test/validation/classification/odp_classification_basic.c > index 81077b6..1336955 100644 > --- a/test/validation/classification/odp_classification_basic.c > +++ b/test/validation/classification/odp_classification_basic.c > @@ -74,28 +74,40 @@ void classification_test_create_pmr_match(void) > odp_pmr_t pmr; > uint16_t val; > uint16_t mask; > + int retval; > odp_pmr_match_t match; > + 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; > > - val = 1024; > - mask = 0xffff; > - match.term = find_first_supported_l3_pmr(); > - match.val = &val; > - match.mask = &mask; > - match.val_sz = sizeof(val); > + pkt_pool = pool_create("pkt_pool"); > + CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID); > > - pmr = odp_pmr_create(&match); > - CU_ASSERT(pmr != ODP_PMR_INVAL); > - CU_ASSERT(odp_pmr_to_u64(pmr) != odp_pmr_to_u64(ODP_PMR_INVAL)); > - odp_pmr_destroy(pmr); > -} > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > > -void classification_test_destroy_pmr(void) > -{ > - odp_pmr_t pmr; > - uint16_t val; > - uint16_t mask; > - int retval; > - odp_pmr_match_t match; > + 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; > @@ -104,12 +116,25 @@ void classification_test_destroy_pmr(void) > match.mask = &mask; > match.val_sz = sizeof(val); > > - pmr = odp_pmr_create(&match); > - retval = odp_pmr_destroy(pmr); > + pmr = odp_cls_pmr_create(&match, 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); > - retval = odp_pmr_destroy(ODP_PMR_INVAL); > - retval = odp_pmr_destroy(ODP_PMR_INVAL); > + > + /* 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); > } > > void classification_test_cos_set_queue(void) > @@ -224,39 +249,44 @@ void classification_test_cos_set_drop(void) > > void classification_test_pmr_match_set_create(void) > { > - odp_pmr_set_t pmr_set; > + odp_pmr_t pmr_set; > int retval; > odp_pmr_match_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; > - for (i = 0; i < PMR_SET_NUM; i++) { > - pmr_terms[i].term = ODP_PMR_TCP_DPORT; > - pmr_terms[i].val = &val; > - pmr_terms[i].mask = &mask; > - pmr_terms[i].val_sz = sizeof(val); > - } > > - retval = odp_pmr_match_set_create(PMR_SET_NUM, pmr_terms, > &pmr_set); > - CU_ASSERT(retval > 0); > - CU_ASSERT(odp_pmr_set_to_u64(pmr_set) != > - odp_pmr_set_to_u64(ODP_PMR_SET_INVAL)); > + pkt_pool = pool_create("pkt_pool"); > + CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID); > > - retval = odp_pmr_match_set_destroy(pmr_set); > - CU_ASSERT(retval == 0); > -} > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > > -void classification_test_pmr_match_set_destroy(void) > -{ > - odp_pmr_set_t pmr_set; > - int retval; > - odp_pmr_match_t pmr_terms[PMR_SET_NUM]; > - uint16_t val = 1024; > - uint16_t mask = 0xffff; > - int i; > + configure_default_cos(pktio, &default_cos, > + &default_queue, &default_pool); > > - retval = odp_pmr_match_set_destroy(ODP_PMR_SET_INVAL); > - CU_ASSERT(retval < 0); > + 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++) { > pmr_terms[i].term = ODP_PMR_TCP_DPORT; > @@ -265,22 +295,31 @@ void classification_test_pmr_match_set_destroy(void) > pmr_terms[i].val_sz = sizeof(val); > } > > - retval = odp_pmr_match_set_create(PMR_SET_NUM, pmr_terms, > &pmr_set); > - CU_ASSERT(retval > 0); > + pmr_set = odp_cls_pmr_create(pmr_terms, PMR_SET_NUM, > + default_cos, cos); > + CU_ASSERT(odp_pmr_to_u64(pmr_set) != > + odp_pmr_to_u64(ODP_PMR_INVAL)); > > - retval = odp_pmr_match_set_destroy(pmr_set); > + retval = odp_cls_pmr_destroy(pmr_set); > 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_destroy_pmr), > 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_match_set_create), > - ODP_TEST_INFO(classification_test_pmr_match_set_destroy), > ODP_TEST_INFO_NULL, > }; > diff --git a/test/validation/classification/odp_classification_common.c > b/test/validation/classification/odp_classification_common.c > index 70d21a2..8a8506a 100644 > --- a/test/validation/classification/odp_classification_common.c > +++ b/test/validation/classification/odp_classification_common.c > @@ -17,6 +17,32 @@ 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 pktio; > + odp_pktio_param_t pktio_param; > + int ret; > + > + if (pool == ODP_POOL_INVALID) > + return ODP_PKTIO_INVALID; > + > + odp_pktio_param_init(&pktio_param); > + if (q_type == ODP_QUEUE_TYPE_POLL) > + pktio_param.in_mode = ODP_PKTIN_MODE_POLL; > + 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; > + } > + > + return pktio; > +} > + > int destroy_inq(odp_pktio_t pktio) > { > odp_queue_t inq; > diff --git a/test/validation/classification/odp_classification_test_pmr.c > b/test/validation/classification/odp_classification_test_pmr.c > index 9e6a9e2..02cb825 100644 > --- a/test/validation/classification/odp_classification_test_pmr.c > +++ b/test/validation/classification/odp_classification_test_pmr.c > @@ -29,32 +29,6 @@ int classification_suite_pmr_init(void) > return 0; > } > > -odp_pktio_t create_pktio(odp_queue_type_t q_type) > -{ > - odp_pktio_t pktio; > - odp_pktio_param_t pktio_param; > - int ret; > - > - if (pkt_pool == ODP_POOL_INVALID) > - return ODP_PKTIO_INVALID; > - > - odp_pktio_param_init(&pktio_param); > - if (q_type == ODP_QUEUE_TYPE_POLL) > - pktio_param.in_mode = ODP_PKTIN_MODE_POLL; > - else > - pktio_param.in_mode = ODP_PKTIN_MODE_SCHED; > - > - pktio = odp_pktio_open("loop", pkt_pool, &pktio_param); > - if (pktio == ODP_PKTIO_INVALID) { > - ret = odp_pool_destroy(pkt_pool); > - if (ret) > - fprintf(stderr, "unable to destroy pool.\n"); > - return ODP_PKTIO_INVALID; > - } > - > - return pktio; > -} > - > int create_default_inq(odp_pktio_t pktio, odp_queue_type_t qtype) > { > odp_queue_param_t qparam; > @@ -162,7 +136,7 @@ void classification_test_pmr_term_tcp_dport(void) > mask = 0xffff; > seqno = 0; > > - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > CU_ASSERT(retval == 0); > @@ -170,15 +144,6 @@ void classification_test_pmr_term_tcp_dport(void) > configure_default_cos(pktio, &default_cos, > &default_queue, &default_pool); > > - match.term = ODP_PMR_TCP_DPORT; > - match.val = &val; > - match.mask = &mask; > - match.val_sz = sizeof(val); > - > - pmr = odp_pmr_create(&match); > - CU_ASSERT(pmr != ODP_PMR_INVAL); > - > - > queue = queue_create("tcp_dport1", true); > CU_ASSERT(queue != ODP_QUEUE_INVALID); > > @@ -194,8 +159,13 @@ void classification_test_pmr_term_tcp_dport(void) > cos = odp_cls_cos_create(cosname, &cls_param); > CU_ASSERT(cos != ODP_COS_INVALID); > > - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > - CU_ASSERT(retval == 0); > + match.term = ODP_PMR_TCP_DPORT; > + match.val = &val; > + match.mask = &mask; > + match.val_sz = sizeof(val); > + > + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); > + CU_ASSERT(pmr != ODP_PMR_INVAL); > > pkt = create_packet(pkt_pool, false, &seq, false); > CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); > @@ -243,7 +213,7 @@ void classification_test_pmr_term_tcp_dport(void) > odp_packet_free(pkt); > odp_cos_destroy(cos); > odp_cos_destroy(default_cos); > - odp_pmr_destroy(pmr); > + odp_cls_pmr_destroy(pmr); > destroy_inq(pktio); > odp_queue_destroy(queue); > odp_queue_destroy(default_queue); > @@ -279,7 +249,7 @@ void classification_test_pmr_term_tcp_sport(void) > mask = 0xffff; > seqno = 0; > > - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > CU_ASSERT(retval == 0); > @@ -287,14 +257,6 @@ void classification_test_pmr_term_tcp_sport(void) > configure_default_cos(pktio, &default_cos, > &default_queue, &default_pool); > > - match.term = ODP_PMR_TCP_SPORT; > - match.val = &val; > - match.mask = &mask; > - match.val_sz = sizeof(val); > - > - pmr = odp_pmr_create(&match); > - CU_ASSERT(pmr != ODP_PMR_INVAL); > - > queue = queue_create("tcp_sport", true); > CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > > @@ -310,8 +272,13 @@ void classification_test_pmr_term_tcp_sport(void) > cos = odp_cls_cos_create(cosname, &cls_param); > CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > > - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > - CU_ASSERT(retval == 0); > + match.term = ODP_PMR_TCP_SPORT; > + match.val = &val; > + match.mask = &mask; > + match.val_sz = sizeof(val); > + > + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); > + CU_ASSERT(pmr != ODP_PMR_INVAL); > > pkt = create_packet(pkt_pool, false, &seq, false); > CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); > @@ -357,7 +324,7 @@ void classification_test_pmr_term_tcp_sport(void) > odp_packet_free(pkt); > odp_cos_destroy(cos); > odp_cos_destroy(default_cos); > - odp_pmr_destroy(pmr); > + odp_cls_pmr_destroy(pmr); > destroy_inq(pktio); > odp_pool_destroy(default_pool); > odp_pool_destroy(pool); > @@ -393,7 +360,7 @@ void classification_test_pmr_term_udp_dport(void) > mask = 0xffff; > seqno = 0; > > - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > CU_ASSERT(retval == 0); > @@ -401,14 +368,6 @@ void classification_test_pmr_term_udp_dport(void) > configure_default_cos(pktio, &default_cos, > &default_queue, &default_pool); > > - match.term = ODP_PMR_UDP_DPORT; > - match.val = &val; > - match.mask = &mask; > - match.val_sz = sizeof(val); > - > - pmr = odp_pmr_create(&match); > - CU_ASSERT(pmr != ODP_PMR_INVAL); > - > queue = queue_create("udp_dport", true); > CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > > @@ -424,8 +383,13 @@ void classification_test_pmr_term_udp_dport(void) > cos = odp_cls_cos_create(cosname, &cls_param); > CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > > - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > - CU_ASSERT(retval == 0); > + match.term = ODP_PMR_UDP_DPORT; > + match.val = &val; > + match.mask = &mask; > + match.val_sz = sizeof(val); > + > + pmr = odp_cls_pmr_create(&match, 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); > @@ -472,7 +436,7 @@ void classification_test_pmr_term_udp_dport(void) > odp_packet_free(pkt); > odp_cos_destroy(cos); > odp_cos_destroy(default_cos); > - odp_pmr_destroy(pmr); > + odp_cls_pmr_destroy(pmr); > destroy_inq(pktio); > odp_queue_destroy(queue); > odp_queue_destroy(default_queue); > @@ -508,7 +472,7 @@ void classification_test_pmr_term_udp_sport(void) > mask = 0xffff; > seqno = 0; > > - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > CU_ASSERT(retval == 0); > @@ -516,14 +480,6 @@ void classification_test_pmr_term_udp_sport(void) > configure_default_cos(pktio, &default_cos, > &default_queue, &default_pool); > > - match.term = ODP_PMR_UDP_SPORT; > - match.val = &val; > - match.mask = &mask; > - match.val_sz = sizeof(val); > - > - pmr = odp_pmr_create(&match); > - CU_ASSERT(pmr != ODP_PMR_INVAL); > - > queue = queue_create("udp_sport", true); > CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > > @@ -539,8 +495,13 @@ void classification_test_pmr_term_udp_sport(void) > cos = odp_cls_cos_create(cosname, &cls_param); > CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > > - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > - CU_ASSERT(retval == 0); > + match.term = ODP_PMR_UDP_SPORT; > + match.val = &val; > + match.mask = &mask; > + match.val_sz = sizeof(val); > + > + pmr = odp_cls_pmr_create(&match, 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); > @@ -586,7 +547,7 @@ void classification_test_pmr_term_udp_sport(void) > > odp_cos_destroy(cos); > odp_cos_destroy(default_cos); > - odp_pmr_destroy(pmr); > + odp_cls_pmr_destroy(pmr); > destroy_inq(pktio); > odp_pool_destroy(default_pool); > odp_pool_destroy(pool); > @@ -621,7 +582,7 @@ void classification_test_pmr_term_ipproto(void) > mask = 0xff; > seqno = 0; > > - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > CU_ASSERT(retval == 0); > @@ -629,14 +590,6 @@ void classification_test_pmr_term_ipproto(void) > configure_default_cos(pktio, &default_cos, > &default_queue, &default_pool); > > - match.term = ODP_PMR_IPPROTO; > - match.val = &val; > - match.mask = &mask; > - match.val_sz = sizeof(val); > - > - pmr = odp_pmr_create(&match); > - CU_ASSERT(pmr != ODP_PMR_INVAL); > - > queue = queue_create("ipproto", true); > CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > > @@ -652,8 +605,13 @@ void classification_test_pmr_term_ipproto(void) > cos = odp_cls_cos_create(cosname, &cls_param); > CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > > - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > - CU_ASSERT(retval == 0); > + match.term = ODP_PMR_IPPROTO; > + match.val = &val; > + match.mask = &mask; > + match.val_sz = sizeof(val); > + > + pmr = odp_cls_pmr_create(&match, 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); > @@ -693,7 +651,7 @@ void classification_test_pmr_term_ipproto(void) > > odp_cos_destroy(cos); > odp_cos_destroy(default_cos); > - odp_pmr_destroy(pmr); > + odp_cls_pmr_destroy(pmr); > odp_packet_free(pkt); > destroy_inq(pktio); > odp_pool_destroy(default_pool); > @@ -729,7 +687,7 @@ void classification_test_pmr_term_dmac(void) > mask = 0xffffffffffff; > seqno = 0; > > - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > CU_ASSERT(retval == 0); > @@ -737,14 +695,6 @@ void classification_test_pmr_term_dmac(void) > configure_default_cos(pktio, &default_cos, > &default_queue, &default_pool); > > - match.term = ODP_PMR_DMAC; > - match.val = &val; > - match.mask = &mask; > - match.val_sz = ODPH_ETHADDR_LEN; > - > - pmr = odp_pmr_create(&match); > - CU_ASSERT(pmr != ODP_PMR_INVAL); > - > queue = queue_create("dmac", true); > CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > > @@ -760,8 +710,13 @@ void classification_test_pmr_term_dmac(void) > cos = odp_cls_cos_create(cosname, &cls_param); > CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > > - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > - CU_ASSERT(retval == 0); > + match.term = ODP_PMR_DMAC; > + match.val = &val; > + match.mask = &mask; > + match.val_sz = ODPH_ETHADDR_LEN; > + > + pmr = odp_cls_pmr_create(&match, 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); > @@ -797,7 +752,7 @@ void classification_test_pmr_term_dmac(void) > > odp_cos_destroy(cos); > odp_cos_destroy(default_cos); > - odp_pmr_destroy(pmr); > + odp_cls_pmr_destroy(pmr); > odp_packet_free(pkt); > destroy_inq(pktio); > odp_pool_destroy(default_pool); > @@ -834,7 +789,7 @@ void classification_test_pmr_term_packet_len(void) > mask = 0xff00; > seqno = 0; > > - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > CU_ASSERT(retval == 0); > @@ -842,14 +797,6 @@ void classification_test_pmr_term_packet_len(void) > configure_default_cos(pktio, &default_cos, > &default_queue, &default_pool); > > - match.term = ODP_PMR_LEN; > - match.val = &val; > - match.mask = &mask; > - match.val_sz = sizeof(val); > - > - pmr = odp_pmr_create(&match); > - CU_ASSERT(pmr != ODP_PMR_INVAL); > - > queue = queue_create("packet_len", true); > CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > > @@ -865,8 +812,13 @@ void classification_test_pmr_term_packet_len(void) > cos = odp_cls_cos_create(cosname, &cls_param); > CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > > - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > - CU_ASSERT(retval == 0); > + match.term = ODP_PMR_LEN; > + match.val = &val; > + match.mask = &mask; > + match.val_sz = sizeof(val); > + > + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); > + CU_ASSERT(pmr != ODP_PMR_INVAL); > > /* create packet of payload length 1024 */ > pkt = create_packet_len(pkt_pool, false, &seq, true, 1024); > @@ -907,7 +859,7 @@ void classification_test_pmr_term_packet_len(void) > > odp_cos_destroy(cos); > odp_cos_destroy(default_cos); > - odp_pmr_destroy(pmr); > + odp_cls_pmr_destroy(pmr); > odp_packet_free(pkt); > destroy_inq(pktio); > odp_pool_destroy(default_pool); > @@ -944,7 +896,7 @@ static void classification_test_pmr_pool_set(void) > mask = 0xff; > seqno = 0; > > - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > CU_ASSERT(retval == 0); > @@ -952,14 +904,6 @@ static void classification_test_pmr_pool_set(void) > configure_default_cos(pktio, &default_cos, > &default_queue, &default_pool); > > - match.term = ODP_PMR_IPPROTO; > - match.val = &val; > - match.mask = &mask; > - match.val_sz = sizeof(val); > - > - pmr = odp_pmr_create(&match); > - CU_ASSERT(pmr != ODP_PMR_INVAL); > - > queue = queue_create("ipproto1", true); > CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > > @@ -982,8 +926,13 @@ static void classification_test_pmr_pool_set(void) > retval = odp_cls_cos_pool_set(cos, pool_new); > CU_ASSERT(retval == 0); > > - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > - CU_ASSERT(retval == 0); > + match.term = ODP_PMR_IPPROTO; > + match.val = &val; > + match.mask = &mask; > + match.val_sz = sizeof(val); > + > + pmr = odp_cls_pmr_create(&match, 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); > @@ -1005,7 +954,7 @@ static void classification_test_pmr_pool_set(void) > > odp_cos_destroy(cos); > odp_cos_destroy(default_cos); > - odp_pmr_destroy(pmr); > + odp_cls_pmr_destroy(pmr); > destroy_inq(pktio); > odp_pool_destroy(default_pool); > odp_pool_destroy(pool); > @@ -1042,7 +991,7 @@ static void classification_test_pmr_queue_set(void) > mask = 0xff; > seqno = 0; > > - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > CU_ASSERT(retval == 0); > @@ -1050,14 +999,6 @@ static void classification_test_pmr_queue_set(void) > configure_default_cos(pktio, &default_cos, > &default_queue, &default_pool); > > - match.term = ODP_PMR_IPPROTO; > - match.val = &val; > - match.mask = &mask; > - match.val_sz = sizeof(val); > - > - pmr = odp_pmr_create(&match); > - CU_ASSERT(pmr != ODP_PMR_INVAL); > - > queue = queue_create("ipproto1", true); > CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > > @@ -1080,8 +1021,13 @@ static void classification_test_pmr_queue_set(void) > retval = odp_cos_queue_set(cos, queue_new); > CU_ASSERT(retval == 0); > > - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > - CU_ASSERT(retval == 0); > + match.term = ODP_PMR_IPPROTO; > + match.val = &val; > + match.mask = &mask; > + match.val_sz = sizeof(val); > + > + pmr = odp_cls_pmr_create(&match, 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); > @@ -1103,7 +1049,7 @@ static void classification_test_pmr_queue_set(void) > > odp_cos_destroy(cos); > odp_cos_destroy(default_cos); > - odp_pmr_destroy(pmr); > + odp_cls_pmr_destroy(pmr); > destroy_inq(pktio); > odp_pool_destroy(default_pool); > odp_pool_destroy(pool); > @@ -1136,22 +1082,13 @@ 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); > + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > CU_ASSERT(retval == 0); > > configure_default_cos(pktio, &default_cos, > &default_queue, &default_pool); > > - parse_ipv4_string(dst_addr, &addr, &mask); > - match.term = ODP_PMR_DIP_ADDR; > - match.val = &addr; > - match.mask = &mask; > - match.val_sz = sizeof(addr); > - > - pmr = odp_pmr_create(&match); > - CU_ASSERT_FATAL(pmr != ODP_PMR_INVAL); > - > queue = queue_create("daddr", true); > CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > > @@ -1167,8 +1104,14 @@ static void classification_test_pmr_term_daddr(void) > cos = odp_cls_cos_create(cosname, &cls_param); > CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > > - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > - CU_ASSERT(retval == 0); > + parse_ipv4_string(dst_addr, &addr, &mask); > + match.term = ODP_PMR_DIP_ADDR; > + match.val = &addr; > + match.mask = &mask; > + match.val_sz = sizeof(addr); > + > + pmr = odp_cls_pmr_create(&match, 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*/ > @@ -1208,7 +1151,7 @@ static void classification_test_pmr_term_daddr(void) > > odp_cos_destroy(cos); > odp_cos_destroy(default_cos); > - odp_pmr_destroy(pmr); > + odp_cls_pmr_destroy(pmr); > odp_packet_free(pkt); > destroy_inq(pktio); > odp_pool_destroy(default_pool); > diff --git a/test/validation/classification/odp_classification_tests.c > b/test/validation/classification/odp_classification_tests.c > index a118728..a468908 100644 > --- a/test/validation/classification/odp_classification_tests.c > +++ b/test/validation/classification/odp_classification_tests.c > @@ -16,7 +16,6 @@ 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_pmr_set_t pmr_set; > > static odp_pool_t pool_default; > static odp_pktio_t pktio_loop; > @@ -107,7 +106,7 @@ int classification_suite_term(void) > odp_cos_destroy(cos_list[i]); > > for (i = 0; i < CLS_ENTRIES; i++) > - odp_pmr_destroy(pmr_list[i]); > + odp_cls_pmr_destroy(pmr_list[i]); > > for (i = 0; i < CLS_ENTRIES; i++) > odp_queue_destroy(queue_list[i]); > @@ -128,7 +127,6 @@ void configure_cls_pmr_chain(void) > > uint16_t val; > uint16_t maskport; > - int retval; > char cosname[ODP_QUEUE_NAME_LEN]; > odp_queue_param_t qparam; > odp_cls_cos_param_t cls_param; > @@ -193,7 +191,9 @@ void configure_cls_pmr_chain(void) > match.val = &addr; > match.mask = &mask; > match.val_sz = sizeof(addr); > - pmr_list[CLS_PMR_CHAIN_SRC] = odp_pmr_create(&match); > + pmr_list[CLS_PMR_CHAIN_SRC] = > + odp_cls_pmr_create(&match, 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; > @@ -202,17 +202,10 @@ void configure_cls_pmr_chain(void) > match.val = &val; > match.mask = &maskport; > match.val_sz = sizeof(val); > - pmr_list[CLS_PMR_CHAIN_DST] = odp_pmr_create(&match); > + pmr_list[CLS_PMR_CHAIN_DST] = > + odp_cls_pmr_create(&match, 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); > - > - retval = odp_pktio_pmr_cos(pmr_list[CLS_PMR_CHAIN_SRC], pktio_loop, > - cos_list[CLS_PMR_CHAIN_SRC]); > - CU_ASSERT(retval == 0); > - > - retval = odp_cos_pmr_cos(pmr_list[CLS_PMR_CHAIN_DST], > - cos_list[CLS_PMR_CHAIN_SRC], > - cos_list[CLS_PMR_CHAIN_DST]); > - CU_ASSERT(retval == 0); > } > > void test_cls_pmr_chain(void) > @@ -504,7 +497,6 @@ void configure_pmr_cos(void) > { > uint16_t val; > uint16_t mask; > - int retval; > odp_pmr_match_t match; > odp_queue_param_t qparam; > odp_cls_cos_param_t cls_param; > @@ -512,16 +504,6 @@ void configure_pmr_cos(void) > char queuename[ODP_QUEUE_NAME_LEN]; > char poolname[ODP_POOL_NAME_LEN]; > > - 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_pmr_create(&match); > - CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); > - > odp_queue_param_init(&qparam); > qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; > qparam.sched.sync = ODP_SCHED_SYNC_NONE; > @@ -545,9 +527,16 @@ void configure_pmr_cos(void) > cos_list[CLS_PMR] = odp_cls_cos_create(cosname, &cls_param); > CU_ASSERT_FATAL(cos_list[CLS_PMR] != ODP_COS_INVALID); > > - retval = odp_pktio_pmr_cos(pmr_list[CLS_PMR], pktio_loop, > - cos_list[CLS_PMR]); > - CU_ASSERT(retval == 0); > + 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], > + cos_list[CLS_PMR]); > + CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); > } > > void test_pmr_cos(void) > @@ -572,9 +561,8 @@ void test_pmr_cos(void) > odp_packet_free(pkt); > } > > -void configure_pktio_pmr_match_set_cos(void) > +void configure_pktio_pmr_composite(void) > { > - int retval; > odp_pmr_match_t pmr_terms[2]; > uint16_t val; > uint16_t maskport; > @@ -587,23 +575,6 @@ void configure_pktio_pmr_match_set_cos(void) > uint32_t addr = 0; > uint32_t mask; > > - 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); > - > - > - 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); > - > - retval = odp_pmr_match_set_create(num_terms, pmr_terms, &pmr_set); > - CU_ASSERT(retval > 0); > - > odp_queue_param_init(&qparam); > qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; > qparam.sched.sync = ODP_SCHED_SYNC_NONE; > @@ -627,9 +598,23 @@ void configure_pktio_pmr_match_set_cos(void) > cos_list[CLS_PMR_SET] = odp_cls_cos_create(cosname, &cls_param); > CU_ASSERT_FATAL(cos_list[CLS_PMR_SET] != ODP_COS_INVALID); > > - retval = odp_pktio_pmr_match_set_cos(pmr_set, pktio_loop, > - cos_list[CLS_PMR_SET]); > - CU_ASSERT(retval == 0); > + 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); > + > + 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, > + cos_list[CLS_DEFAULT], > + cos_list[CLS_PMR_SET]); > + CU_ASSERT_FATAL(pmr_list[CLS_PMR_SET] != ODP_PMR_INVAL); > } > > void test_pktio_pmr_match_set_cos(void) > @@ -695,7 +680,7 @@ void classification_test_pktio_configure(void) > if (TEST_PMR) > configure_pmr_cos(); > if (TEST_PMR_SET) > - configure_pktio_pmr_match_set_cos(); > + configure_pktio_pmr_composite(); > } > > void classification_test_pktio_test(void) > diff --git > a/test/validation/classification/odp_classification_testsuites.h > b/test/validation/classification/odp_classification_testsuites.h > index 19d5ae2..851f0a3 100644 > --- a/test/validation/classification/odp_classification_testsuites.h > +++ b/test/validation/classification/odp_classification_testsuites.h > @@ -27,7 +27,7 @@ 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_pktio_t create_pktio(odp_queue_type_t q_type, odp_pool_t pool); > int create_default_inq(odp_pktio_t pktio, odp_queue_type_t qtype); > void configure_default_cos(odp_pktio_t pktio, odp_cos_t *cos, > odp_queue_t *queue, odp_pool_t *pool); > @@ -46,7 +46,7 @@ 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_match_set_cos(void); > +void configure_pktio_pmr_composite(void); > void test_pktio_pmr_match_set_cos(void); > int destroy_inq(odp_pktio_t pktio); > odp_pmr_term_t find_first_supported_l3_pmr(void); > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
Thanks Bill. Looks like the latest merge in api-next has created conflict in my patch. I will rebase to HEAD and post V4. Regards, Bala On 3 February 2016 at 21:37, Bill Fischofer <bill.fischofer@linaro.org> wrote: > Part 3 of this patch fails to apply to the head of api-next for me: > > bill@Ubuntu15:~/linaro/balapmr$ git am --reject ~/Mail/Incoming/Bala/7 > Applying: validation: classification: adds validation suite for pmr create > api > Checking patch test/validation/classification/classification.h... > Checking patch test/validation/classification/odp_classification_basic.c... > Checking patch test/validation/classification/odp_classification_common.c... > Checking patch > test/validation/classification/odp_classification_test_pmr.c... > error: while searching for: > return 0; > } > > odp_pktio_t create_pktio(odp_queue_type_t q_type) > { > odp_pktio_t pktio; > odp_pktio_param_t pktio_param; > int ret; > > if (pkt_pool == ODP_POOL_INVALID) > return ODP_PKTIO_INVALID; > > odp_pktio_param_init(&pktio_param); > if (q_type == ODP_QUEUE_TYPE_POLL) > pktio_param.in_mode = ODP_PKTIN_MODE_POLL; > else > pktio_param.in_mode = ODP_PKTIN_MODE_SCHED; > > pktio = odp_pktio_open("loop", pkt_pool, &pktio_param); > if (pktio == ODP_PKTIO_INVALID) { > ret = odp_pool_destroy(pkt_pool); > if (ret) > fprintf(stderr, "unable to destroy pool.\n"); > return ODP_PKTIO_INVALID; > } > > return pktio; > } > > int create_default_inq(odp_pktio_t pktio, odp_queue_type_t qtype) > { > odp_queue_param_t qparam; > > error: patch failed: > test/validation/classification/odp_classification_test_pmr.c:29 > Hunk #2 succeeded at 161 (offset 25 lines). > Hunk #3 succeeded at 169 (offset 25 lines). > Hunk #4 succeeded at 184 (offset 25 lines). > Hunk #5 succeeded at 238 (offset 25 lines). > Hunk #6 succeeded at 274 (offset 25 lines). > Hunk #7 succeeded at 282 (offset 25 lines). > Hunk #8 succeeded at 297 (offset 25 lines). > Hunk #9 succeeded at 349 (offset 25 lines). > Hunk #10 succeeded at 385 (offset 25 lines). > Hunk #11 succeeded at 393 (offset 25 lines). > Hunk #12 succeeded at 408 (offset 25 lines). > Hunk #13 succeeded at 461 (offset 25 lines). > Hunk #14 succeeded at 497 (offset 25 lines). > Hunk #15 succeeded at 505 (offset 25 lines). > Hunk #16 succeeded at 520 (offset 25 lines). > Hunk #17 succeeded at 572 (offset 25 lines). > Hunk #18 succeeded at 607 (offset 25 lines). > Hunk #19 succeeded at 615 (offset 25 lines). > Hunk #20 succeeded at 630 (offset 25 lines). > Hunk #21 succeeded at 676 (offset 25 lines). > Hunk #22 succeeded at 712 (offset 25 lines). > Hunk #23 succeeded at 720 (offset 25 lines). > Hunk #24 succeeded at 735 (offset 25 lines). > Hunk #25 succeeded at 777 (offset 25 lines). > Hunk #26 succeeded at 814 (offset 25 lines). > Hunk #27 succeeded at 822 (offset 25 lines). > Hunk #28 succeeded at 837 (offset 25 lines). > Hunk #29 succeeded at 884 (offset 25 lines). > Hunk #30 succeeded at 921 (offset 25 lines). > Hunk #31 succeeded at 929 (offset 25 lines). > Hunk #32 succeeded at 951 (offset 25 lines). > Hunk #33 succeeded at 979 (offset 25 lines). > Hunk #34 succeeded at 1016 (offset 25 lines). > Hunk #35 succeeded at 1024 (offset 25 lines). > Hunk #36 succeeded at 1046 (offset 25 lines). > Hunk #37 succeeded at 1074 (offset 25 lines). > Hunk #38 succeeded at 1107 (offset 25 lines). > Hunk #39 succeeded at 1129 (offset 25 lines). > Hunk #40 succeeded at 1176 (offset 25 lines). > Checking patch test/validation/classification/odp_classification_tests.c... > Hunk #4 succeeded at 189 (offset -2 lines). > Hunk #5 succeeded at 200 (offset -2 lines). > Hunk #6 succeeded at 494 (offset -3 lines). > error: while searching for: > char queuename[ODP_QUEUE_NAME_LEN]; > char poolname[ODP_POOL_NAME_LEN]; > > 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_pmr_create(&match); > CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); > > odp_queue_param_init(&qparam); > qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; > qparam.sched.sync = ODP_SCHED_SYNC_NONE; > > error: patch failed: > test/validation/classification/odp_classification_tests.c:512 > Hunk #8 succeeded at 533 (offset 6 lines). > Hunk #9 succeeded at 567 (offset 6 lines). > error: while searching for: > uint32_t addr = 0; > uint32_t mask; > > 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); > > > 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); > > retval = odp_pmr_match_set_create(num_terms, pmr_terms, &pmr_set); > CU_ASSERT(retval > 0); > > odp_queue_param_init(&qparam); > qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; > qparam.sched.sync = ODP_SCHED_SYNC_NONE; > > error: patch failed: > test/validation/classification/odp_classification_tests.c:587 > Hunk #11 succeeded at 620 (offset 22 lines). > Hunk #12 succeeded at 702 (offset 22 lines). > Checking patch > test/validation/classification/odp_classification_testsuites.h... > Applied patch test/validation/classification/classification.h cleanly. > Applied patch test/validation/classification/odp_classification_basic.c > cleanly. > Applied patch test/validation/classification/odp_classification_common.c > cleanly. > Applying patch test/validation/classification/odp_classification_test_pmr.c > with 1 reject... > Rejected hunk #1. > Hunk #2 applied cleanly. > Hunk #3 applied cleanly. > Hunk #4 applied cleanly. > Hunk #5 applied cleanly. > Hunk #6 applied cleanly. > Hunk #7 applied cleanly. > Hunk #8 applied cleanly. > Hunk #9 applied cleanly. > Hunk #10 applied cleanly. > Hunk #11 applied cleanly. > Hunk #12 applied cleanly. > Hunk #13 applied cleanly. > Hunk #14 applied cleanly. > Hunk #15 applied cleanly. > Hunk #16 applied cleanly. > Hunk #17 applied cleanly. > Hunk #18 applied cleanly. > Hunk #19 applied cleanly. > Hunk #20 applied cleanly. > Hunk #21 applied cleanly. > Hunk #22 applied cleanly. > Hunk #23 applied cleanly. > Hunk #24 applied cleanly. > Hunk #25 applied cleanly. > Hunk #26 applied cleanly. > Hunk #27 applied cleanly. > Hunk #28 applied cleanly. > Hunk #29 applied cleanly. > Hunk #30 applied cleanly. > Hunk #31 applied cleanly. > Hunk #32 applied cleanly. > Hunk #33 applied cleanly. > Hunk #34 applied cleanly. > Hunk #35 applied cleanly. > Hunk #36 applied cleanly. > Hunk #37 applied cleanly. > Hunk #38 applied cleanly. > Hunk #39 applied cleanly. > Hunk #40 applied cleanly. > Applying patch test/validation/classification/odp_classification_tests.c > with 2 rejects... > Hunk #1 applied cleanly. > Hunk #2 applied cleanly. > Hunk #3 applied cleanly. > Hunk #4 applied cleanly. > Hunk #5 applied cleanly. > Hunk #6 applied cleanly. > Rejected hunk #7. > Hunk #8 applied cleanly. > Hunk #9 applied cleanly. > Rejected hunk #10. > Hunk #11 applied cleanly. > Hunk #12 applied cleanly. > Applied patch test/validation/classification/odp_classification_testsuites.h > cleanly. > Patch failed at 0001 validation: classification: adds validation suite for > pmr create api > The copy of the patch that failed is found in: > /home/bill/linaro/balapmr/.git/rebase-apply/patch > When you have resolved this problem, run "git am --continue". > If you prefer to skip this patch, run "git am --skip" instead. > To restore the original branch and stop patching, run "git am --abort". > > On Tue, Feb 2, 2016 at 8:07 AM, Balasubramanian Manoharan > <bala.manoharan@linaro.org> wrote: >> >> Adds validation suite for packet match rule create functions. >> >> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> >> --- >> test/validation/classification/classification.h | 1 - >> .../classification/odp_classification_basic.c | 141 +++++++----- >> .../classification/odp_classification_common.c | 26 +++ >> .../classification/odp_classification_test_pmr.c | 239 >> ++++++++------------- >> .../classification/odp_classification_tests.c | 87 ++++---- >> .../classification/odp_classification_testsuites.h | 4 +- >> 6 files changed, 245 insertions(+), 253 deletions(-) >> >> diff --git a/test/validation/classification/classification.h >> b/test/validation/classification/classification.h >> index 5508af7..c987cca 100644 >> --- a/test/validation/classification/classification.h >> +++ b/test/validation/classification/classification.h >> @@ -59,7 +59,6 @@ >> void classification_test_create_cos(void); >> void classification_test_destroy_cos(void); >> void classification_test_create_pmr_match(void); >> -void classification_test_destroy_pmr(void); >> void classification_test_cos_set_queue(void); >> void classification_test_cos_set_pool(void); >> void classification_test_cos_set_drop(void); >> diff --git a/test/validation/classification/odp_classification_basic.c >> b/test/validation/classification/odp_classification_basic.c >> index 81077b6..1336955 100644 >> --- a/test/validation/classification/odp_classification_basic.c >> +++ b/test/validation/classification/odp_classification_basic.c >> @@ -74,28 +74,40 @@ void classification_test_create_pmr_match(void) >> odp_pmr_t pmr; >> uint16_t val; >> uint16_t mask; >> + int retval; >> odp_pmr_match_t match; >> + 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; >> >> - val = 1024; >> - mask = 0xffff; >> - match.term = find_first_supported_l3_pmr(); >> - match.val = &val; >> - match.mask = &mask; >> - match.val_sz = sizeof(val); >> + pkt_pool = pool_create("pkt_pool"); >> + CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID); >> >> - pmr = odp_pmr_create(&match); >> - CU_ASSERT(pmr != ODP_PMR_INVAL); >> - CU_ASSERT(odp_pmr_to_u64(pmr) != odp_pmr_to_u64(ODP_PMR_INVAL)); >> - odp_pmr_destroy(pmr); >> -} >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); >> >> -void classification_test_destroy_pmr(void) >> -{ >> - odp_pmr_t pmr; >> - uint16_t val; >> - uint16_t mask; >> - int retval; >> - odp_pmr_match_t match; >> + 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; >> @@ -104,12 +116,25 @@ void classification_test_destroy_pmr(void) >> match.mask = &mask; >> match.val_sz = sizeof(val); >> >> - pmr = odp_pmr_create(&match); >> - retval = odp_pmr_destroy(pmr); >> + pmr = odp_cls_pmr_create(&match, 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); >> - retval = odp_pmr_destroy(ODP_PMR_INVAL); >> - retval = odp_pmr_destroy(ODP_PMR_INVAL); >> + >> + /* 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); >> } >> >> void classification_test_cos_set_queue(void) >> @@ -224,39 +249,44 @@ void classification_test_cos_set_drop(void) >> >> void classification_test_pmr_match_set_create(void) >> { >> - odp_pmr_set_t pmr_set; >> + odp_pmr_t pmr_set; >> int retval; >> odp_pmr_match_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; >> - for (i = 0; i < PMR_SET_NUM; i++) { >> - pmr_terms[i].term = ODP_PMR_TCP_DPORT; >> - pmr_terms[i].val = &val; >> - pmr_terms[i].mask = &mask; >> - pmr_terms[i].val_sz = sizeof(val); >> - } >> >> - retval = odp_pmr_match_set_create(PMR_SET_NUM, pmr_terms, >> &pmr_set); >> - CU_ASSERT(retval > 0); >> - CU_ASSERT(odp_pmr_set_to_u64(pmr_set) != >> - odp_pmr_set_to_u64(ODP_PMR_SET_INVAL)); >> + pkt_pool = pool_create("pkt_pool"); >> + CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID); >> >> - retval = odp_pmr_match_set_destroy(pmr_set); >> - CU_ASSERT(retval == 0); >> -} >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); >> >> -void classification_test_pmr_match_set_destroy(void) >> -{ >> - odp_pmr_set_t pmr_set; >> - int retval; >> - odp_pmr_match_t pmr_terms[PMR_SET_NUM]; >> - uint16_t val = 1024; >> - uint16_t mask = 0xffff; >> - int i; >> + configure_default_cos(pktio, &default_cos, >> + &default_queue, &default_pool); >> >> - retval = odp_pmr_match_set_destroy(ODP_PMR_SET_INVAL); >> - CU_ASSERT(retval < 0); >> + 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++) { >> pmr_terms[i].term = ODP_PMR_TCP_DPORT; >> @@ -265,22 +295,31 @@ void classification_test_pmr_match_set_destroy(void) >> pmr_terms[i].val_sz = sizeof(val); >> } >> >> - retval = odp_pmr_match_set_create(PMR_SET_NUM, pmr_terms, >> &pmr_set); >> - CU_ASSERT(retval > 0); >> + pmr_set = odp_cls_pmr_create(pmr_terms, PMR_SET_NUM, >> + default_cos, cos); >> + CU_ASSERT(odp_pmr_to_u64(pmr_set) != >> + odp_pmr_to_u64(ODP_PMR_INVAL)); >> >> - retval = odp_pmr_match_set_destroy(pmr_set); >> + retval = odp_cls_pmr_destroy(pmr_set); >> 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_destroy_pmr), >> 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_match_set_create), >> - ODP_TEST_INFO(classification_test_pmr_match_set_destroy), >> ODP_TEST_INFO_NULL, >> }; >> diff --git a/test/validation/classification/odp_classification_common.c >> b/test/validation/classification/odp_classification_common.c >> index 70d21a2..8a8506a 100644 >> --- a/test/validation/classification/odp_classification_common.c >> +++ b/test/validation/classification/odp_classification_common.c >> @@ -17,6 +17,32 @@ 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 pktio; >> + odp_pktio_param_t pktio_param; >> + int ret; >> + >> + if (pool == ODP_POOL_INVALID) >> + return ODP_PKTIO_INVALID; >> + >> + odp_pktio_param_init(&pktio_param); >> + if (q_type == ODP_QUEUE_TYPE_POLL) >> + pktio_param.in_mode = ODP_PKTIN_MODE_POLL; >> + 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; >> + } >> + >> + return pktio; >> +} >> + >> int destroy_inq(odp_pktio_t pktio) >> { >> odp_queue_t inq; >> diff --git a/test/validation/classification/odp_classification_test_pmr.c >> b/test/validation/classification/odp_classification_test_pmr.c >> index 9e6a9e2..02cb825 100644 >> --- a/test/validation/classification/odp_classification_test_pmr.c >> +++ b/test/validation/classification/odp_classification_test_pmr.c >> @@ -29,32 +29,6 @@ int classification_suite_pmr_init(void) >> return 0; >> } >> >> -odp_pktio_t create_pktio(odp_queue_type_t q_type) >> -{ >> - odp_pktio_t pktio; >> - odp_pktio_param_t pktio_param; >> - int ret; >> - >> - if (pkt_pool == ODP_POOL_INVALID) >> - return ODP_PKTIO_INVALID; >> - >> - odp_pktio_param_init(&pktio_param); >> - if (q_type == ODP_QUEUE_TYPE_POLL) >> - pktio_param.in_mode = ODP_PKTIN_MODE_POLL; >> - else >> - pktio_param.in_mode = ODP_PKTIN_MODE_SCHED; >> - >> - pktio = odp_pktio_open("loop", pkt_pool, &pktio_param); >> - if (pktio == ODP_PKTIO_INVALID) { >> - ret = odp_pool_destroy(pkt_pool); >> - if (ret) >> - fprintf(stderr, "unable to destroy pool.\n"); >> - return ODP_PKTIO_INVALID; >> - } >> - >> - return pktio; >> -} >> - >> int create_default_inq(odp_pktio_t pktio, odp_queue_type_t qtype) >> { >> odp_queue_param_t qparam; >> @@ -162,7 +136,7 @@ void classification_test_pmr_term_tcp_dport(void) >> mask = 0xffff; >> seqno = 0; >> >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); >> CU_ASSERT(retval == 0); >> @@ -170,15 +144,6 @@ void classification_test_pmr_term_tcp_dport(void) >> configure_default_cos(pktio, &default_cos, >> &default_queue, &default_pool); >> >> - match.term = ODP_PMR_TCP_DPORT; >> - match.val = &val; >> - match.mask = &mask; >> - match.val_sz = sizeof(val); >> - >> - pmr = odp_pmr_create(&match); >> - CU_ASSERT(pmr != ODP_PMR_INVAL); >> - >> - >> queue = queue_create("tcp_dport1", true); >> CU_ASSERT(queue != ODP_QUEUE_INVALID); >> >> @@ -194,8 +159,13 @@ void classification_test_pmr_term_tcp_dport(void) >> cos = odp_cls_cos_create(cosname, &cls_param); >> CU_ASSERT(cos != ODP_COS_INVALID); >> >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); >> - CU_ASSERT(retval == 0); >> + match.term = ODP_PMR_TCP_DPORT; >> + match.val = &val; >> + match.mask = &mask; >> + match.val_sz = sizeof(val); >> + >> + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); >> + CU_ASSERT(pmr != ODP_PMR_INVAL); >> >> pkt = create_packet(pkt_pool, false, &seq, false); >> CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); >> @@ -243,7 +213,7 @@ void classification_test_pmr_term_tcp_dport(void) >> odp_packet_free(pkt); >> odp_cos_destroy(cos); >> odp_cos_destroy(default_cos); >> - odp_pmr_destroy(pmr); >> + odp_cls_pmr_destroy(pmr); >> destroy_inq(pktio); >> odp_queue_destroy(queue); >> odp_queue_destroy(default_queue); >> @@ -279,7 +249,7 @@ void classification_test_pmr_term_tcp_sport(void) >> mask = 0xffff; >> seqno = 0; >> >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); >> CU_ASSERT(retval == 0); >> @@ -287,14 +257,6 @@ void classification_test_pmr_term_tcp_sport(void) >> configure_default_cos(pktio, &default_cos, >> &default_queue, &default_pool); >> >> - match.term = ODP_PMR_TCP_SPORT; >> - match.val = &val; >> - match.mask = &mask; >> - match.val_sz = sizeof(val); >> - >> - pmr = odp_pmr_create(&match); >> - CU_ASSERT(pmr != ODP_PMR_INVAL); >> - >> queue = queue_create("tcp_sport", true); >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); >> >> @@ -310,8 +272,13 @@ void classification_test_pmr_term_tcp_sport(void) >> cos = odp_cls_cos_create(cosname, &cls_param); >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); >> >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); >> - CU_ASSERT(retval == 0); >> + match.term = ODP_PMR_TCP_SPORT; >> + match.val = &val; >> + match.mask = &mask; >> + match.val_sz = sizeof(val); >> + >> + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); >> + CU_ASSERT(pmr != ODP_PMR_INVAL); >> >> pkt = create_packet(pkt_pool, false, &seq, false); >> CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); >> @@ -357,7 +324,7 @@ void classification_test_pmr_term_tcp_sport(void) >> odp_packet_free(pkt); >> odp_cos_destroy(cos); >> odp_cos_destroy(default_cos); >> - odp_pmr_destroy(pmr); >> + odp_cls_pmr_destroy(pmr); >> destroy_inq(pktio); >> odp_pool_destroy(default_pool); >> odp_pool_destroy(pool); >> @@ -393,7 +360,7 @@ void classification_test_pmr_term_udp_dport(void) >> mask = 0xffff; >> seqno = 0; >> >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); >> CU_ASSERT(retval == 0); >> @@ -401,14 +368,6 @@ void classification_test_pmr_term_udp_dport(void) >> configure_default_cos(pktio, &default_cos, >> &default_queue, &default_pool); >> >> - match.term = ODP_PMR_UDP_DPORT; >> - match.val = &val; >> - match.mask = &mask; >> - match.val_sz = sizeof(val); >> - >> - pmr = odp_pmr_create(&match); >> - CU_ASSERT(pmr != ODP_PMR_INVAL); >> - >> queue = queue_create("udp_dport", true); >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); >> >> @@ -424,8 +383,13 @@ void classification_test_pmr_term_udp_dport(void) >> cos = odp_cls_cos_create(cosname, &cls_param); >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); >> >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); >> - CU_ASSERT(retval == 0); >> + match.term = ODP_PMR_UDP_DPORT; >> + match.val = &val; >> + match.mask = &mask; >> + match.val_sz = sizeof(val); >> + >> + pmr = odp_cls_pmr_create(&match, 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); >> @@ -472,7 +436,7 @@ void classification_test_pmr_term_udp_dport(void) >> odp_packet_free(pkt); >> odp_cos_destroy(cos); >> odp_cos_destroy(default_cos); >> - odp_pmr_destroy(pmr); >> + odp_cls_pmr_destroy(pmr); >> destroy_inq(pktio); >> odp_queue_destroy(queue); >> odp_queue_destroy(default_queue); >> @@ -508,7 +472,7 @@ void classification_test_pmr_term_udp_sport(void) >> mask = 0xffff; >> seqno = 0; >> >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); >> CU_ASSERT(retval == 0); >> @@ -516,14 +480,6 @@ void classification_test_pmr_term_udp_sport(void) >> configure_default_cos(pktio, &default_cos, >> &default_queue, &default_pool); >> >> - match.term = ODP_PMR_UDP_SPORT; >> - match.val = &val; >> - match.mask = &mask; >> - match.val_sz = sizeof(val); >> - >> - pmr = odp_pmr_create(&match); >> - CU_ASSERT(pmr != ODP_PMR_INVAL); >> - >> queue = queue_create("udp_sport", true); >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); >> >> @@ -539,8 +495,13 @@ void classification_test_pmr_term_udp_sport(void) >> cos = odp_cls_cos_create(cosname, &cls_param); >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); >> >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); >> - CU_ASSERT(retval == 0); >> + match.term = ODP_PMR_UDP_SPORT; >> + match.val = &val; >> + match.mask = &mask; >> + match.val_sz = sizeof(val); >> + >> + pmr = odp_cls_pmr_create(&match, 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); >> @@ -586,7 +547,7 @@ void classification_test_pmr_term_udp_sport(void) >> >> odp_cos_destroy(cos); >> odp_cos_destroy(default_cos); >> - odp_pmr_destroy(pmr); >> + odp_cls_pmr_destroy(pmr); >> destroy_inq(pktio); >> odp_pool_destroy(default_pool); >> odp_pool_destroy(pool); >> @@ -621,7 +582,7 @@ void classification_test_pmr_term_ipproto(void) >> mask = 0xff; >> seqno = 0; >> >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); >> CU_ASSERT(retval == 0); >> @@ -629,14 +590,6 @@ void classification_test_pmr_term_ipproto(void) >> configure_default_cos(pktio, &default_cos, >> &default_queue, &default_pool); >> >> - match.term = ODP_PMR_IPPROTO; >> - match.val = &val; >> - match.mask = &mask; >> - match.val_sz = sizeof(val); >> - >> - pmr = odp_pmr_create(&match); >> - CU_ASSERT(pmr != ODP_PMR_INVAL); >> - >> queue = queue_create("ipproto", true); >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); >> >> @@ -652,8 +605,13 @@ void classification_test_pmr_term_ipproto(void) >> cos = odp_cls_cos_create(cosname, &cls_param); >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); >> >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); >> - CU_ASSERT(retval == 0); >> + match.term = ODP_PMR_IPPROTO; >> + match.val = &val; >> + match.mask = &mask; >> + match.val_sz = sizeof(val); >> + >> + pmr = odp_cls_pmr_create(&match, 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); >> @@ -693,7 +651,7 @@ void classification_test_pmr_term_ipproto(void) >> >> odp_cos_destroy(cos); >> odp_cos_destroy(default_cos); >> - odp_pmr_destroy(pmr); >> + odp_cls_pmr_destroy(pmr); >> odp_packet_free(pkt); >> destroy_inq(pktio); >> odp_pool_destroy(default_pool); >> @@ -729,7 +687,7 @@ void classification_test_pmr_term_dmac(void) >> mask = 0xffffffffffff; >> seqno = 0; >> >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); >> CU_ASSERT(retval == 0); >> @@ -737,14 +695,6 @@ void classification_test_pmr_term_dmac(void) >> configure_default_cos(pktio, &default_cos, >> &default_queue, &default_pool); >> >> - match.term = ODP_PMR_DMAC; >> - match.val = &val; >> - match.mask = &mask; >> - match.val_sz = ODPH_ETHADDR_LEN; >> - >> - pmr = odp_pmr_create(&match); >> - CU_ASSERT(pmr != ODP_PMR_INVAL); >> - >> queue = queue_create("dmac", true); >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); >> >> @@ -760,8 +710,13 @@ void classification_test_pmr_term_dmac(void) >> cos = odp_cls_cos_create(cosname, &cls_param); >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); >> >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); >> - CU_ASSERT(retval == 0); >> + match.term = ODP_PMR_DMAC; >> + match.val = &val; >> + match.mask = &mask; >> + match.val_sz = ODPH_ETHADDR_LEN; >> + >> + pmr = odp_cls_pmr_create(&match, 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); >> @@ -797,7 +752,7 @@ void classification_test_pmr_term_dmac(void) >> >> odp_cos_destroy(cos); >> odp_cos_destroy(default_cos); >> - odp_pmr_destroy(pmr); >> + odp_cls_pmr_destroy(pmr); >> odp_packet_free(pkt); >> destroy_inq(pktio); >> odp_pool_destroy(default_pool); >> @@ -834,7 +789,7 @@ void classification_test_pmr_term_packet_len(void) >> mask = 0xff00; >> seqno = 0; >> >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); >> CU_ASSERT(retval == 0); >> @@ -842,14 +797,6 @@ void classification_test_pmr_term_packet_len(void) >> configure_default_cos(pktio, &default_cos, >> &default_queue, &default_pool); >> >> - match.term = ODP_PMR_LEN; >> - match.val = &val; >> - match.mask = &mask; >> - match.val_sz = sizeof(val); >> - >> - pmr = odp_pmr_create(&match); >> - CU_ASSERT(pmr != ODP_PMR_INVAL); >> - >> queue = queue_create("packet_len", true); >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); >> >> @@ -865,8 +812,13 @@ void classification_test_pmr_term_packet_len(void) >> cos = odp_cls_cos_create(cosname, &cls_param); >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); >> >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); >> - CU_ASSERT(retval == 0); >> + match.term = ODP_PMR_LEN; >> + match.val = &val; >> + match.mask = &mask; >> + match.val_sz = sizeof(val); >> + >> + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); >> + CU_ASSERT(pmr != ODP_PMR_INVAL); >> >> /* create packet of payload length 1024 */ >> pkt = create_packet_len(pkt_pool, false, &seq, true, 1024); >> @@ -907,7 +859,7 @@ void classification_test_pmr_term_packet_len(void) >> >> odp_cos_destroy(cos); >> odp_cos_destroy(default_cos); >> - odp_pmr_destroy(pmr); >> + odp_cls_pmr_destroy(pmr); >> odp_packet_free(pkt); >> destroy_inq(pktio); >> odp_pool_destroy(default_pool); >> @@ -944,7 +896,7 @@ static void classification_test_pmr_pool_set(void) >> mask = 0xff; >> seqno = 0; >> >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); >> CU_ASSERT(retval == 0); >> @@ -952,14 +904,6 @@ static void classification_test_pmr_pool_set(void) >> configure_default_cos(pktio, &default_cos, >> &default_queue, &default_pool); >> >> - match.term = ODP_PMR_IPPROTO; >> - match.val = &val; >> - match.mask = &mask; >> - match.val_sz = sizeof(val); >> - >> - pmr = odp_pmr_create(&match); >> - CU_ASSERT(pmr != ODP_PMR_INVAL); >> - >> queue = queue_create("ipproto1", true); >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); >> >> @@ -982,8 +926,13 @@ static void classification_test_pmr_pool_set(void) >> retval = odp_cls_cos_pool_set(cos, pool_new); >> CU_ASSERT(retval == 0); >> >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); >> - CU_ASSERT(retval == 0); >> + match.term = ODP_PMR_IPPROTO; >> + match.val = &val; >> + match.mask = &mask; >> + match.val_sz = sizeof(val); >> + >> + pmr = odp_cls_pmr_create(&match, 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); >> @@ -1005,7 +954,7 @@ static void classification_test_pmr_pool_set(void) >> >> odp_cos_destroy(cos); >> odp_cos_destroy(default_cos); >> - odp_pmr_destroy(pmr); >> + odp_cls_pmr_destroy(pmr); >> destroy_inq(pktio); >> odp_pool_destroy(default_pool); >> odp_pool_destroy(pool); >> @@ -1042,7 +991,7 @@ static void classification_test_pmr_queue_set(void) >> mask = 0xff; >> seqno = 0; >> >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); >> CU_ASSERT(retval == 0); >> @@ -1050,14 +999,6 @@ static void classification_test_pmr_queue_set(void) >> configure_default_cos(pktio, &default_cos, >> &default_queue, &default_pool); >> >> - match.term = ODP_PMR_IPPROTO; >> - match.val = &val; >> - match.mask = &mask; >> - match.val_sz = sizeof(val); >> - >> - pmr = odp_pmr_create(&match); >> - CU_ASSERT(pmr != ODP_PMR_INVAL); >> - >> queue = queue_create("ipproto1", true); >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); >> >> @@ -1080,8 +1021,13 @@ static void classification_test_pmr_queue_set(void) >> retval = odp_cos_queue_set(cos, queue_new); >> CU_ASSERT(retval == 0); >> >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); >> - CU_ASSERT(retval == 0); >> + match.term = ODP_PMR_IPPROTO; >> + match.val = &val; >> + match.mask = &mask; >> + match.val_sz = sizeof(val); >> + >> + pmr = odp_cls_pmr_create(&match, 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); >> @@ -1103,7 +1049,7 @@ static void classification_test_pmr_queue_set(void) >> >> odp_cos_destroy(cos); >> odp_cos_destroy(default_cos); >> - odp_pmr_destroy(pmr); >> + odp_cls_pmr_destroy(pmr); >> destroy_inq(pktio); >> odp_pool_destroy(default_pool); >> odp_pool_destroy(pool); >> @@ -1136,22 +1082,13 @@ 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); >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); >> CU_ASSERT(retval == 0); >> >> configure_default_cos(pktio, &default_cos, >> &default_queue, &default_pool); >> >> - parse_ipv4_string(dst_addr, &addr, &mask); >> - match.term = ODP_PMR_DIP_ADDR; >> - match.val = &addr; >> - match.mask = &mask; >> - match.val_sz = sizeof(addr); >> - >> - pmr = odp_pmr_create(&match); >> - CU_ASSERT_FATAL(pmr != ODP_PMR_INVAL); >> - >> queue = queue_create("daddr", true); >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); >> >> @@ -1167,8 +1104,14 @@ static void >> classification_test_pmr_term_daddr(void) >> cos = odp_cls_cos_create(cosname, &cls_param); >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); >> >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); >> - CU_ASSERT(retval == 0); >> + parse_ipv4_string(dst_addr, &addr, &mask); >> + match.term = ODP_PMR_DIP_ADDR; >> + match.val = &addr; >> + match.mask = &mask; >> + match.val_sz = sizeof(addr); >> + >> + pmr = odp_cls_pmr_create(&match, 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*/ >> @@ -1208,7 +1151,7 @@ static void classification_test_pmr_term_daddr(void) >> >> odp_cos_destroy(cos); >> odp_cos_destroy(default_cos); >> - odp_pmr_destroy(pmr); >> + odp_cls_pmr_destroy(pmr); >> odp_packet_free(pkt); >> destroy_inq(pktio); >> odp_pool_destroy(default_pool); >> diff --git a/test/validation/classification/odp_classification_tests.c >> b/test/validation/classification/odp_classification_tests.c >> index a118728..a468908 100644 >> --- a/test/validation/classification/odp_classification_tests.c >> +++ b/test/validation/classification/odp_classification_tests.c >> @@ -16,7 +16,6 @@ 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_pmr_set_t pmr_set; >> >> static odp_pool_t pool_default; >> static odp_pktio_t pktio_loop; >> @@ -107,7 +106,7 @@ int classification_suite_term(void) >> odp_cos_destroy(cos_list[i]); >> >> for (i = 0; i < CLS_ENTRIES; i++) >> - odp_pmr_destroy(pmr_list[i]); >> + odp_cls_pmr_destroy(pmr_list[i]); >> >> for (i = 0; i < CLS_ENTRIES; i++) >> odp_queue_destroy(queue_list[i]); >> @@ -128,7 +127,6 @@ void configure_cls_pmr_chain(void) >> >> uint16_t val; >> uint16_t maskport; >> - int retval; >> char cosname[ODP_QUEUE_NAME_LEN]; >> odp_queue_param_t qparam; >> odp_cls_cos_param_t cls_param; >> @@ -193,7 +191,9 @@ void configure_cls_pmr_chain(void) >> match.val = &addr; >> match.mask = &mask; >> match.val_sz = sizeof(addr); >> - pmr_list[CLS_PMR_CHAIN_SRC] = odp_pmr_create(&match); >> + pmr_list[CLS_PMR_CHAIN_SRC] = >> + odp_cls_pmr_create(&match, 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; >> @@ -202,17 +202,10 @@ void configure_cls_pmr_chain(void) >> match.val = &val; >> match.mask = &maskport; >> match.val_sz = sizeof(val); >> - pmr_list[CLS_PMR_CHAIN_DST] = odp_pmr_create(&match); >> + pmr_list[CLS_PMR_CHAIN_DST] = >> + odp_cls_pmr_create(&match, 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); >> - >> - retval = odp_pktio_pmr_cos(pmr_list[CLS_PMR_CHAIN_SRC], >> pktio_loop, >> - cos_list[CLS_PMR_CHAIN_SRC]); >> - CU_ASSERT(retval == 0); >> - >> - retval = odp_cos_pmr_cos(pmr_list[CLS_PMR_CHAIN_DST], >> - cos_list[CLS_PMR_CHAIN_SRC], >> - cos_list[CLS_PMR_CHAIN_DST]); >> - CU_ASSERT(retval == 0); >> } >> >> void test_cls_pmr_chain(void) >> @@ -504,7 +497,6 @@ void configure_pmr_cos(void) >> { >> uint16_t val; >> uint16_t mask; >> - int retval; >> odp_pmr_match_t match; >> odp_queue_param_t qparam; >> odp_cls_cos_param_t cls_param; >> @@ -512,16 +504,6 @@ void configure_pmr_cos(void) >> char queuename[ODP_QUEUE_NAME_LEN]; >> char poolname[ODP_POOL_NAME_LEN]; >> >> - 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_pmr_create(&match); >> - CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); >> - >> odp_queue_param_init(&qparam); >> qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; >> qparam.sched.sync = ODP_SCHED_SYNC_NONE; >> @@ -545,9 +527,16 @@ void configure_pmr_cos(void) >> cos_list[CLS_PMR] = odp_cls_cos_create(cosname, &cls_param); >> CU_ASSERT_FATAL(cos_list[CLS_PMR] != ODP_COS_INVALID); >> >> - retval = odp_pktio_pmr_cos(pmr_list[CLS_PMR], pktio_loop, >> - cos_list[CLS_PMR]); >> - CU_ASSERT(retval == 0); >> + 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], >> + cos_list[CLS_PMR]); >> + CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); >> } >> >> void test_pmr_cos(void) >> @@ -572,9 +561,8 @@ void test_pmr_cos(void) >> odp_packet_free(pkt); >> } >> >> -void configure_pktio_pmr_match_set_cos(void) >> +void configure_pktio_pmr_composite(void) >> { >> - int retval; >> odp_pmr_match_t pmr_terms[2]; >> uint16_t val; >> uint16_t maskport; >> @@ -587,23 +575,6 @@ void configure_pktio_pmr_match_set_cos(void) >> uint32_t addr = 0; >> uint32_t mask; >> >> - 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); >> - >> - >> - 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); >> - >> - retval = odp_pmr_match_set_create(num_terms, pmr_terms, &pmr_set); >> - CU_ASSERT(retval > 0); >> - >> odp_queue_param_init(&qparam); >> qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; >> qparam.sched.sync = ODP_SCHED_SYNC_NONE; >> @@ -627,9 +598,23 @@ void configure_pktio_pmr_match_set_cos(void) >> cos_list[CLS_PMR_SET] = odp_cls_cos_create(cosname, &cls_param); >> CU_ASSERT_FATAL(cos_list[CLS_PMR_SET] != ODP_COS_INVALID); >> >> - retval = odp_pktio_pmr_match_set_cos(pmr_set, pktio_loop, >> - cos_list[CLS_PMR_SET]); >> - CU_ASSERT(retval == 0); >> + 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); >> + >> + 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, >> + cos_list[CLS_DEFAULT], >> + cos_list[CLS_PMR_SET]); >> + CU_ASSERT_FATAL(pmr_list[CLS_PMR_SET] != ODP_PMR_INVAL); >> } >> >> void test_pktio_pmr_match_set_cos(void) >> @@ -695,7 +680,7 @@ void classification_test_pktio_configure(void) >> if (TEST_PMR) >> configure_pmr_cos(); >> if (TEST_PMR_SET) >> - configure_pktio_pmr_match_set_cos(); >> + configure_pktio_pmr_composite(); >> } >> >> void classification_test_pktio_test(void) >> diff --git >> a/test/validation/classification/odp_classification_testsuites.h >> b/test/validation/classification/odp_classification_testsuites.h >> index 19d5ae2..851f0a3 100644 >> --- a/test/validation/classification/odp_classification_testsuites.h >> +++ b/test/validation/classification/odp_classification_testsuites.h >> @@ -27,7 +27,7 @@ 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_pktio_t create_pktio(odp_queue_type_t q_type, odp_pool_t pool); >> int create_default_inq(odp_pktio_t pktio, odp_queue_type_t qtype); >> void configure_default_cos(odp_pktio_t pktio, odp_cos_t *cos, >> odp_queue_t *queue, odp_pool_t *pool); >> @@ -46,7 +46,7 @@ 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_match_set_cos(void); >> +void configure_pktio_pmr_composite(void); >> void test_pktio_pmr_match_set_cos(void); >> int destroy_inq(odp_pktio_t pktio); >> odp_pmr_term_t find_first_supported_l3_pmr(void); >> -- >> 1.9.1 >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> https://lists.linaro.org/mailman/listinfo/lng-odp > >
Ok, I'll review/test that as soon as it gets posted. Thanks. On Wed, Feb 3, 2016 at 10:59 AM, Bala Manoharan <bala.manoharan@linaro.org> wrote: > Thanks Bill. > Looks like the latest merge in api-next has created conflict in my patch. > I will rebase to HEAD and post V4. > > Regards, > Bala > > > On 3 February 2016 at 21:37, Bill Fischofer <bill.fischofer@linaro.org> > wrote: > > Part 3 of this patch fails to apply to the head of api-next for me: > > > > bill@Ubuntu15:~/linaro/balapmr$ git am --reject ~/Mail/Incoming/Bala/7 > > Applying: validation: classification: adds validation suite for pmr > create > > api > > Checking patch test/validation/classification/classification.h... > > Checking patch > test/validation/classification/odp_classification_basic.c... > > Checking patch > test/validation/classification/odp_classification_common.c... > > Checking patch > > test/validation/classification/odp_classification_test_pmr.c... > > error: while searching for: > > return 0; > > } > > > > odp_pktio_t create_pktio(odp_queue_type_t q_type) > > { > > odp_pktio_t pktio; > > odp_pktio_param_t pktio_param; > > int ret; > > > > if (pkt_pool == ODP_POOL_INVALID) > > return ODP_PKTIO_INVALID; > > > > odp_pktio_param_init(&pktio_param); > > if (q_type == ODP_QUEUE_TYPE_POLL) > > pktio_param.in_mode = ODP_PKTIN_MODE_POLL; > > else > > pktio_param.in_mode = ODP_PKTIN_MODE_SCHED; > > > > pktio = odp_pktio_open("loop", pkt_pool, &pktio_param); > > if (pktio == ODP_PKTIO_INVALID) { > > ret = odp_pool_destroy(pkt_pool); > > if (ret) > > fprintf(stderr, "unable to destroy pool.\n"); > > return ODP_PKTIO_INVALID; > > } > > > > return pktio; > > } > > > > int create_default_inq(odp_pktio_t pktio, odp_queue_type_t qtype) > > { > > odp_queue_param_t qparam; > > > > error: patch failed: > > test/validation/classification/odp_classification_test_pmr.c:29 > > Hunk #2 succeeded at 161 (offset 25 lines). > > Hunk #3 succeeded at 169 (offset 25 lines). > > Hunk #4 succeeded at 184 (offset 25 lines). > > Hunk #5 succeeded at 238 (offset 25 lines). > > Hunk #6 succeeded at 274 (offset 25 lines). > > Hunk #7 succeeded at 282 (offset 25 lines). > > Hunk #8 succeeded at 297 (offset 25 lines). > > Hunk #9 succeeded at 349 (offset 25 lines). > > Hunk #10 succeeded at 385 (offset 25 lines). > > Hunk #11 succeeded at 393 (offset 25 lines). > > Hunk #12 succeeded at 408 (offset 25 lines). > > Hunk #13 succeeded at 461 (offset 25 lines). > > Hunk #14 succeeded at 497 (offset 25 lines). > > Hunk #15 succeeded at 505 (offset 25 lines). > > Hunk #16 succeeded at 520 (offset 25 lines). > > Hunk #17 succeeded at 572 (offset 25 lines). > > Hunk #18 succeeded at 607 (offset 25 lines). > > Hunk #19 succeeded at 615 (offset 25 lines). > > Hunk #20 succeeded at 630 (offset 25 lines). > > Hunk #21 succeeded at 676 (offset 25 lines). > > Hunk #22 succeeded at 712 (offset 25 lines). > > Hunk #23 succeeded at 720 (offset 25 lines). > > Hunk #24 succeeded at 735 (offset 25 lines). > > Hunk #25 succeeded at 777 (offset 25 lines). > > Hunk #26 succeeded at 814 (offset 25 lines). > > Hunk #27 succeeded at 822 (offset 25 lines). > > Hunk #28 succeeded at 837 (offset 25 lines). > > Hunk #29 succeeded at 884 (offset 25 lines). > > Hunk #30 succeeded at 921 (offset 25 lines). > > Hunk #31 succeeded at 929 (offset 25 lines). > > Hunk #32 succeeded at 951 (offset 25 lines). > > Hunk #33 succeeded at 979 (offset 25 lines). > > Hunk #34 succeeded at 1016 (offset 25 lines). > > Hunk #35 succeeded at 1024 (offset 25 lines). > > Hunk #36 succeeded at 1046 (offset 25 lines). > > Hunk #37 succeeded at 1074 (offset 25 lines). > > Hunk #38 succeeded at 1107 (offset 25 lines). > > Hunk #39 succeeded at 1129 (offset 25 lines). > > Hunk #40 succeeded at 1176 (offset 25 lines). > > Checking patch > test/validation/classification/odp_classification_tests.c... > > Hunk #4 succeeded at 189 (offset -2 lines). > > Hunk #5 succeeded at 200 (offset -2 lines). > > Hunk #6 succeeded at 494 (offset -3 lines). > > error: while searching for: > > char queuename[ODP_QUEUE_NAME_LEN]; > > char poolname[ODP_POOL_NAME_LEN]; > > > > 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_pmr_create(&match); > > CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); > > > > odp_queue_param_init(&qparam); > > qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; > > qparam.sched.sync = ODP_SCHED_SYNC_NONE; > > > > error: patch failed: > > test/validation/classification/odp_classification_tests.c:512 > > Hunk #8 succeeded at 533 (offset 6 lines). > > Hunk #9 succeeded at 567 (offset 6 lines). > > error: while searching for: > > uint32_t addr = 0; > > uint32_t mask; > > > > 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); > > > > > > 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); > > > > retval = odp_pmr_match_set_create(num_terms, pmr_terms, &pmr_set); > > CU_ASSERT(retval > 0); > > > > odp_queue_param_init(&qparam); > > qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; > > qparam.sched.sync = ODP_SCHED_SYNC_NONE; > > > > error: patch failed: > > test/validation/classification/odp_classification_tests.c:587 > > Hunk #11 succeeded at 620 (offset 22 lines). > > Hunk #12 succeeded at 702 (offset 22 lines). > > Checking patch > > test/validation/classification/odp_classification_testsuites.h... > > Applied patch test/validation/classification/classification.h cleanly. > > Applied patch test/validation/classification/odp_classification_basic.c > > cleanly. > > Applied patch test/validation/classification/odp_classification_common.c > > cleanly. > > Applying patch > test/validation/classification/odp_classification_test_pmr.c > > with 1 reject... > > Rejected hunk #1. > > Hunk #2 applied cleanly. > > Hunk #3 applied cleanly. > > Hunk #4 applied cleanly. > > Hunk #5 applied cleanly. > > Hunk #6 applied cleanly. > > Hunk #7 applied cleanly. > > Hunk #8 applied cleanly. > > Hunk #9 applied cleanly. > > Hunk #10 applied cleanly. > > Hunk #11 applied cleanly. > > Hunk #12 applied cleanly. > > Hunk #13 applied cleanly. > > Hunk #14 applied cleanly. > > Hunk #15 applied cleanly. > > Hunk #16 applied cleanly. > > Hunk #17 applied cleanly. > > Hunk #18 applied cleanly. > > Hunk #19 applied cleanly. > > Hunk #20 applied cleanly. > > Hunk #21 applied cleanly. > > Hunk #22 applied cleanly. > > Hunk #23 applied cleanly. > > Hunk #24 applied cleanly. > > Hunk #25 applied cleanly. > > Hunk #26 applied cleanly. > > Hunk #27 applied cleanly. > > Hunk #28 applied cleanly. > > Hunk #29 applied cleanly. > > Hunk #30 applied cleanly. > > Hunk #31 applied cleanly. > > Hunk #32 applied cleanly. > > Hunk #33 applied cleanly. > > Hunk #34 applied cleanly. > > Hunk #35 applied cleanly. > > Hunk #36 applied cleanly. > > Hunk #37 applied cleanly. > > Hunk #38 applied cleanly. > > Hunk #39 applied cleanly. > > Hunk #40 applied cleanly. > > Applying patch test/validation/classification/odp_classification_tests.c > > with 2 rejects... > > Hunk #1 applied cleanly. > > Hunk #2 applied cleanly. > > Hunk #3 applied cleanly. > > Hunk #4 applied cleanly. > > Hunk #5 applied cleanly. > > Hunk #6 applied cleanly. > > Rejected hunk #7. > > Hunk #8 applied cleanly. > > Hunk #9 applied cleanly. > > Rejected hunk #10. > > Hunk #11 applied cleanly. > > Hunk #12 applied cleanly. > > Applied patch > test/validation/classification/odp_classification_testsuites.h > > cleanly. > > Patch failed at 0001 validation: classification: adds validation suite > for > > pmr create api > > The copy of the patch that failed is found in: > > /home/bill/linaro/balapmr/.git/rebase-apply/patch > > When you have resolved this problem, run "git am --continue". > > If you prefer to skip this patch, run "git am --skip" instead. > > To restore the original branch and stop patching, run "git am --abort". > > > > On Tue, Feb 2, 2016 at 8:07 AM, Balasubramanian Manoharan > > <bala.manoharan@linaro.org> wrote: > >> > >> Adds validation suite for packet match rule create functions. > >> > >> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> > >> --- > >> test/validation/classification/classification.h | 1 - > >> .../classification/odp_classification_basic.c | 141 +++++++----- > >> .../classification/odp_classification_common.c | 26 +++ > >> .../classification/odp_classification_test_pmr.c | 239 > >> ++++++++------------- > >> .../classification/odp_classification_tests.c | 87 ++++---- > >> .../classification/odp_classification_testsuites.h | 4 +- > >> 6 files changed, 245 insertions(+), 253 deletions(-) > >> > >> diff --git a/test/validation/classification/classification.h > >> b/test/validation/classification/classification.h > >> index 5508af7..c987cca 100644 > >> --- a/test/validation/classification/classification.h > >> +++ b/test/validation/classification/classification.h > >> @@ -59,7 +59,6 @@ > >> void classification_test_create_cos(void); > >> void classification_test_destroy_cos(void); > >> void classification_test_create_pmr_match(void); > >> -void classification_test_destroy_pmr(void); > >> void classification_test_cos_set_queue(void); > >> void classification_test_cos_set_pool(void); > >> void classification_test_cos_set_drop(void); > >> diff --git a/test/validation/classification/odp_classification_basic.c > >> b/test/validation/classification/odp_classification_basic.c > >> index 81077b6..1336955 100644 > >> --- a/test/validation/classification/odp_classification_basic.c > >> +++ b/test/validation/classification/odp_classification_basic.c > >> @@ -74,28 +74,40 @@ void classification_test_create_pmr_match(void) > >> odp_pmr_t pmr; > >> uint16_t val; > >> uint16_t mask; > >> + int retval; > >> odp_pmr_match_t match; > >> + 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; > >> > >> - val = 1024; > >> - mask = 0xffff; > >> - match.term = find_first_supported_l3_pmr(); > >> - match.val = &val; > >> - match.mask = &mask; > >> - match.val_sz = sizeof(val); > >> + pkt_pool = pool_create("pkt_pool"); > >> + CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID); > >> > >> - pmr = odp_pmr_create(&match); > >> - CU_ASSERT(pmr != ODP_PMR_INVAL); > >> - CU_ASSERT(odp_pmr_to_u64(pmr) != odp_pmr_to_u64(ODP_PMR_INVAL)); > >> - odp_pmr_destroy(pmr); > >> -} > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > >> > >> -void classification_test_destroy_pmr(void) > >> -{ > >> - odp_pmr_t pmr; > >> - uint16_t val; > >> - uint16_t mask; > >> - int retval; > >> - odp_pmr_match_t match; > >> + 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; > >> @@ -104,12 +116,25 @@ void classification_test_destroy_pmr(void) > >> match.mask = &mask; > >> match.val_sz = sizeof(val); > >> > >> - pmr = odp_pmr_create(&match); > >> - retval = odp_pmr_destroy(pmr); > >> + pmr = odp_cls_pmr_create(&match, 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); > >> - retval = odp_pmr_destroy(ODP_PMR_INVAL); > >> - retval = odp_pmr_destroy(ODP_PMR_INVAL); > >> + > >> + /* 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); > >> } > >> > >> void classification_test_cos_set_queue(void) > >> @@ -224,39 +249,44 @@ void classification_test_cos_set_drop(void) > >> > >> void classification_test_pmr_match_set_create(void) > >> { > >> - odp_pmr_set_t pmr_set; > >> + odp_pmr_t pmr_set; > >> int retval; > >> odp_pmr_match_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; > >> - for (i = 0; i < PMR_SET_NUM; i++) { > >> - pmr_terms[i].term = ODP_PMR_TCP_DPORT; > >> - pmr_terms[i].val = &val; > >> - pmr_terms[i].mask = &mask; > >> - pmr_terms[i].val_sz = sizeof(val); > >> - } > >> > >> - retval = odp_pmr_match_set_create(PMR_SET_NUM, pmr_terms, > >> &pmr_set); > >> - CU_ASSERT(retval > 0); > >> - CU_ASSERT(odp_pmr_set_to_u64(pmr_set) != > >> - odp_pmr_set_to_u64(ODP_PMR_SET_INVAL)); > >> + pkt_pool = pool_create("pkt_pool"); > >> + CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID); > >> > >> - retval = odp_pmr_match_set_destroy(pmr_set); > >> - CU_ASSERT(retval == 0); > >> -} > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > >> > >> -void classification_test_pmr_match_set_destroy(void) > >> -{ > >> - odp_pmr_set_t pmr_set; > >> - int retval; > >> - odp_pmr_match_t pmr_terms[PMR_SET_NUM]; > >> - uint16_t val = 1024; > >> - uint16_t mask = 0xffff; > >> - int i; > >> + configure_default_cos(pktio, &default_cos, > >> + &default_queue, &default_pool); > >> > >> - retval = odp_pmr_match_set_destroy(ODP_PMR_SET_INVAL); > >> - CU_ASSERT(retval < 0); > >> + 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++) { > >> pmr_terms[i].term = ODP_PMR_TCP_DPORT; > >> @@ -265,22 +295,31 @@ void > classification_test_pmr_match_set_destroy(void) > >> pmr_terms[i].val_sz = sizeof(val); > >> } > >> > >> - retval = odp_pmr_match_set_create(PMR_SET_NUM, pmr_terms, > >> &pmr_set); > >> - CU_ASSERT(retval > 0); > >> + pmr_set = odp_cls_pmr_create(pmr_terms, PMR_SET_NUM, > >> + default_cos, cos); > >> + CU_ASSERT(odp_pmr_to_u64(pmr_set) != > >> + odp_pmr_to_u64(ODP_PMR_INVAL)); > >> > >> - retval = odp_pmr_match_set_destroy(pmr_set); > >> + retval = odp_cls_pmr_destroy(pmr_set); > >> 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_destroy_pmr), > >> 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_match_set_create), > >> - ODP_TEST_INFO(classification_test_pmr_match_set_destroy), > >> ODP_TEST_INFO_NULL, > >> }; > >> diff --git a/test/validation/classification/odp_classification_common.c > >> b/test/validation/classification/odp_classification_common.c > >> index 70d21a2..8a8506a 100644 > >> --- a/test/validation/classification/odp_classification_common.c > >> +++ b/test/validation/classification/odp_classification_common.c > >> @@ -17,6 +17,32 @@ 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 pktio; > >> + odp_pktio_param_t pktio_param; > >> + int ret; > >> + > >> + if (pool == ODP_POOL_INVALID) > >> + return ODP_PKTIO_INVALID; > >> + > >> + odp_pktio_param_init(&pktio_param); > >> + if (q_type == ODP_QUEUE_TYPE_POLL) > >> + pktio_param.in_mode = ODP_PKTIN_MODE_POLL; > >> + 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; > >> + } > >> + > >> + return pktio; > >> +} > >> + > >> int destroy_inq(odp_pktio_t pktio) > >> { > >> odp_queue_t inq; > >> diff --git > a/test/validation/classification/odp_classification_test_pmr.c > >> b/test/validation/classification/odp_classification_test_pmr.c > >> index 9e6a9e2..02cb825 100644 > >> --- a/test/validation/classification/odp_classification_test_pmr.c > >> +++ b/test/validation/classification/odp_classification_test_pmr.c > >> @@ -29,32 +29,6 @@ int classification_suite_pmr_init(void) > >> return 0; > >> } > >> > >> -odp_pktio_t create_pktio(odp_queue_type_t q_type) > >> -{ > >> - odp_pktio_t pktio; > >> - odp_pktio_param_t pktio_param; > >> - int ret; > >> - > >> - if (pkt_pool == ODP_POOL_INVALID) > >> - return ODP_PKTIO_INVALID; > >> - > >> - odp_pktio_param_init(&pktio_param); > >> - if (q_type == ODP_QUEUE_TYPE_POLL) > >> - pktio_param.in_mode = ODP_PKTIN_MODE_POLL; > >> - else > >> - pktio_param.in_mode = ODP_PKTIN_MODE_SCHED; > >> - > >> - pktio = odp_pktio_open("loop", pkt_pool, &pktio_param); > >> - if (pktio == ODP_PKTIO_INVALID) { > >> - ret = odp_pool_destroy(pkt_pool); > >> - if (ret) > >> - fprintf(stderr, "unable to destroy pool.\n"); > >> - return ODP_PKTIO_INVALID; > >> - } > >> - > >> - return pktio; > >> -} > >> - > >> int create_default_inq(odp_pktio_t pktio, odp_queue_type_t qtype) > >> { > >> odp_queue_param_t qparam; > >> @@ -162,7 +136,7 @@ void classification_test_pmr_term_tcp_dport(void) > >> mask = 0xffff; > >> seqno = 0; > >> > >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > >> CU_ASSERT(retval == 0); > >> @@ -170,15 +144,6 @@ void classification_test_pmr_term_tcp_dport(void) > >> configure_default_cos(pktio, &default_cos, > >> &default_queue, &default_pool); > >> > >> - match.term = ODP_PMR_TCP_DPORT; > >> - match.val = &val; > >> - match.mask = &mask; > >> - match.val_sz = sizeof(val); > >> - > >> - pmr = odp_pmr_create(&match); > >> - CU_ASSERT(pmr != ODP_PMR_INVAL); > >> - > >> - > >> queue = queue_create("tcp_dport1", true); > >> CU_ASSERT(queue != ODP_QUEUE_INVALID); > >> > >> @@ -194,8 +159,13 @@ void classification_test_pmr_term_tcp_dport(void) > >> cos = odp_cls_cos_create(cosname, &cls_param); > >> CU_ASSERT(cos != ODP_COS_INVALID); > >> > >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > >> - CU_ASSERT(retval == 0); > >> + match.term = ODP_PMR_TCP_DPORT; > >> + match.val = &val; > >> + match.mask = &mask; > >> + match.val_sz = sizeof(val); > >> + > >> + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); > >> + CU_ASSERT(pmr != ODP_PMR_INVAL); > >> > >> pkt = create_packet(pkt_pool, false, &seq, false); > >> CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); > >> @@ -243,7 +213,7 @@ void classification_test_pmr_term_tcp_dport(void) > >> odp_packet_free(pkt); > >> odp_cos_destroy(cos); > >> odp_cos_destroy(default_cos); > >> - odp_pmr_destroy(pmr); > >> + odp_cls_pmr_destroy(pmr); > >> destroy_inq(pktio); > >> odp_queue_destroy(queue); > >> odp_queue_destroy(default_queue); > >> @@ -279,7 +249,7 @@ void classification_test_pmr_term_tcp_sport(void) > >> mask = 0xffff; > >> seqno = 0; > >> > >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > >> CU_ASSERT(retval == 0); > >> @@ -287,14 +257,6 @@ void classification_test_pmr_term_tcp_sport(void) > >> configure_default_cos(pktio, &default_cos, > >> &default_queue, &default_pool); > >> > >> - match.term = ODP_PMR_TCP_SPORT; > >> - match.val = &val; > >> - match.mask = &mask; > >> - match.val_sz = sizeof(val); > >> - > >> - pmr = odp_pmr_create(&match); > >> - CU_ASSERT(pmr != ODP_PMR_INVAL); > >> - > >> queue = queue_create("tcp_sport", true); > >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > >> > >> @@ -310,8 +272,13 @@ void classification_test_pmr_term_tcp_sport(void) > >> cos = odp_cls_cos_create(cosname, &cls_param); > >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > >> > >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > >> - CU_ASSERT(retval == 0); > >> + match.term = ODP_PMR_TCP_SPORT; > >> + match.val = &val; > >> + match.mask = &mask; > >> + match.val_sz = sizeof(val); > >> + > >> + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); > >> + CU_ASSERT(pmr != ODP_PMR_INVAL); > >> > >> pkt = create_packet(pkt_pool, false, &seq, false); > >> CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); > >> @@ -357,7 +324,7 @@ void classification_test_pmr_term_tcp_sport(void) > >> odp_packet_free(pkt); > >> odp_cos_destroy(cos); > >> odp_cos_destroy(default_cos); > >> - odp_pmr_destroy(pmr); > >> + odp_cls_pmr_destroy(pmr); > >> destroy_inq(pktio); > >> odp_pool_destroy(default_pool); > >> odp_pool_destroy(pool); > >> @@ -393,7 +360,7 @@ void classification_test_pmr_term_udp_dport(void) > >> mask = 0xffff; > >> seqno = 0; > >> > >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > >> CU_ASSERT(retval == 0); > >> @@ -401,14 +368,6 @@ void classification_test_pmr_term_udp_dport(void) > >> configure_default_cos(pktio, &default_cos, > >> &default_queue, &default_pool); > >> > >> - match.term = ODP_PMR_UDP_DPORT; > >> - match.val = &val; > >> - match.mask = &mask; > >> - match.val_sz = sizeof(val); > >> - > >> - pmr = odp_pmr_create(&match); > >> - CU_ASSERT(pmr != ODP_PMR_INVAL); > >> - > >> queue = queue_create("udp_dport", true); > >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > >> > >> @@ -424,8 +383,13 @@ void classification_test_pmr_term_udp_dport(void) > >> cos = odp_cls_cos_create(cosname, &cls_param); > >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > >> > >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > >> - CU_ASSERT(retval == 0); > >> + match.term = ODP_PMR_UDP_DPORT; > >> + match.val = &val; > >> + match.mask = &mask; > >> + match.val_sz = sizeof(val); > >> + > >> + pmr = odp_cls_pmr_create(&match, 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); > >> @@ -472,7 +436,7 @@ void classification_test_pmr_term_udp_dport(void) > >> odp_packet_free(pkt); > >> odp_cos_destroy(cos); > >> odp_cos_destroy(default_cos); > >> - odp_pmr_destroy(pmr); > >> + odp_cls_pmr_destroy(pmr); > >> destroy_inq(pktio); > >> odp_queue_destroy(queue); > >> odp_queue_destroy(default_queue); > >> @@ -508,7 +472,7 @@ void classification_test_pmr_term_udp_sport(void) > >> mask = 0xffff; > >> seqno = 0; > >> > >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > >> CU_ASSERT(retval == 0); > >> @@ -516,14 +480,6 @@ void classification_test_pmr_term_udp_sport(void) > >> configure_default_cos(pktio, &default_cos, > >> &default_queue, &default_pool); > >> > >> - match.term = ODP_PMR_UDP_SPORT; > >> - match.val = &val; > >> - match.mask = &mask; > >> - match.val_sz = sizeof(val); > >> - > >> - pmr = odp_pmr_create(&match); > >> - CU_ASSERT(pmr != ODP_PMR_INVAL); > >> - > >> queue = queue_create("udp_sport", true); > >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > >> > >> @@ -539,8 +495,13 @@ void classification_test_pmr_term_udp_sport(void) > >> cos = odp_cls_cos_create(cosname, &cls_param); > >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > >> > >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > >> - CU_ASSERT(retval == 0); > >> + match.term = ODP_PMR_UDP_SPORT; > >> + match.val = &val; > >> + match.mask = &mask; > >> + match.val_sz = sizeof(val); > >> + > >> + pmr = odp_cls_pmr_create(&match, 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); > >> @@ -586,7 +547,7 @@ void classification_test_pmr_term_udp_sport(void) > >> > >> odp_cos_destroy(cos); > >> odp_cos_destroy(default_cos); > >> - odp_pmr_destroy(pmr); > >> + odp_cls_pmr_destroy(pmr); > >> destroy_inq(pktio); > >> odp_pool_destroy(default_pool); > >> odp_pool_destroy(pool); > >> @@ -621,7 +582,7 @@ void classification_test_pmr_term_ipproto(void) > >> mask = 0xff; > >> seqno = 0; > >> > >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > >> CU_ASSERT(retval == 0); > >> @@ -629,14 +590,6 @@ void classification_test_pmr_term_ipproto(void) > >> configure_default_cos(pktio, &default_cos, > >> &default_queue, &default_pool); > >> > >> - match.term = ODP_PMR_IPPROTO; > >> - match.val = &val; > >> - match.mask = &mask; > >> - match.val_sz = sizeof(val); > >> - > >> - pmr = odp_pmr_create(&match); > >> - CU_ASSERT(pmr != ODP_PMR_INVAL); > >> - > >> queue = queue_create("ipproto", true); > >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > >> > >> @@ -652,8 +605,13 @@ void classification_test_pmr_term_ipproto(void) > >> cos = odp_cls_cos_create(cosname, &cls_param); > >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > >> > >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > >> - CU_ASSERT(retval == 0); > >> + match.term = ODP_PMR_IPPROTO; > >> + match.val = &val; > >> + match.mask = &mask; > >> + match.val_sz = sizeof(val); > >> + > >> + pmr = odp_cls_pmr_create(&match, 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); > >> @@ -693,7 +651,7 @@ void classification_test_pmr_term_ipproto(void) > >> > >> odp_cos_destroy(cos); > >> odp_cos_destroy(default_cos); > >> - odp_pmr_destroy(pmr); > >> + odp_cls_pmr_destroy(pmr); > >> odp_packet_free(pkt); > >> destroy_inq(pktio); > >> odp_pool_destroy(default_pool); > >> @@ -729,7 +687,7 @@ void classification_test_pmr_term_dmac(void) > >> mask = 0xffffffffffff; > >> seqno = 0; > >> > >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > >> CU_ASSERT(retval == 0); > >> @@ -737,14 +695,6 @@ void classification_test_pmr_term_dmac(void) > >> configure_default_cos(pktio, &default_cos, > >> &default_queue, &default_pool); > >> > >> - match.term = ODP_PMR_DMAC; > >> - match.val = &val; > >> - match.mask = &mask; > >> - match.val_sz = ODPH_ETHADDR_LEN; > >> - > >> - pmr = odp_pmr_create(&match); > >> - CU_ASSERT(pmr != ODP_PMR_INVAL); > >> - > >> queue = queue_create("dmac", true); > >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > >> > >> @@ -760,8 +710,13 @@ void classification_test_pmr_term_dmac(void) > >> cos = odp_cls_cos_create(cosname, &cls_param); > >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > >> > >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > >> - CU_ASSERT(retval == 0); > >> + match.term = ODP_PMR_DMAC; > >> + match.val = &val; > >> + match.mask = &mask; > >> + match.val_sz = ODPH_ETHADDR_LEN; > >> + > >> + pmr = odp_cls_pmr_create(&match, 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); > >> @@ -797,7 +752,7 @@ void classification_test_pmr_term_dmac(void) > >> > >> odp_cos_destroy(cos); > >> odp_cos_destroy(default_cos); > >> - odp_pmr_destroy(pmr); > >> + odp_cls_pmr_destroy(pmr); > >> odp_packet_free(pkt); > >> destroy_inq(pktio); > >> odp_pool_destroy(default_pool); > >> @@ -834,7 +789,7 @@ void classification_test_pmr_term_packet_len(void) > >> mask = 0xff00; > >> seqno = 0; > >> > >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > >> CU_ASSERT(retval == 0); > >> @@ -842,14 +797,6 @@ void classification_test_pmr_term_packet_len(void) > >> configure_default_cos(pktio, &default_cos, > >> &default_queue, &default_pool); > >> > >> - match.term = ODP_PMR_LEN; > >> - match.val = &val; > >> - match.mask = &mask; > >> - match.val_sz = sizeof(val); > >> - > >> - pmr = odp_pmr_create(&match); > >> - CU_ASSERT(pmr != ODP_PMR_INVAL); > >> - > >> queue = queue_create("packet_len", true); > >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > >> > >> @@ -865,8 +812,13 @@ void classification_test_pmr_term_packet_len(void) > >> cos = odp_cls_cos_create(cosname, &cls_param); > >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > >> > >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > >> - CU_ASSERT(retval == 0); > >> + match.term = ODP_PMR_LEN; > >> + match.val = &val; > >> + match.mask = &mask; > >> + match.val_sz = sizeof(val); > >> + > >> + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); > >> + CU_ASSERT(pmr != ODP_PMR_INVAL); > >> > >> /* create packet of payload length 1024 */ > >> pkt = create_packet_len(pkt_pool, false, &seq, true, 1024); > >> @@ -907,7 +859,7 @@ void classification_test_pmr_term_packet_len(void) > >> > >> odp_cos_destroy(cos); > >> odp_cos_destroy(default_cos); > >> - odp_pmr_destroy(pmr); > >> + odp_cls_pmr_destroy(pmr); > >> odp_packet_free(pkt); > >> destroy_inq(pktio); > >> odp_pool_destroy(default_pool); > >> @@ -944,7 +896,7 @@ static void classification_test_pmr_pool_set(void) > >> mask = 0xff; > >> seqno = 0; > >> > >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > >> CU_ASSERT(retval == 0); > >> @@ -952,14 +904,6 @@ static void classification_test_pmr_pool_set(void) > >> configure_default_cos(pktio, &default_cos, > >> &default_queue, &default_pool); > >> > >> - match.term = ODP_PMR_IPPROTO; > >> - match.val = &val; > >> - match.mask = &mask; > >> - match.val_sz = sizeof(val); > >> - > >> - pmr = odp_pmr_create(&match); > >> - CU_ASSERT(pmr != ODP_PMR_INVAL); > >> - > >> queue = queue_create("ipproto1", true); > >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > >> > >> @@ -982,8 +926,13 @@ static void classification_test_pmr_pool_set(void) > >> retval = odp_cls_cos_pool_set(cos, pool_new); > >> CU_ASSERT(retval == 0); > >> > >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > >> - CU_ASSERT(retval == 0); > >> + match.term = ODP_PMR_IPPROTO; > >> + match.val = &val; > >> + match.mask = &mask; > >> + match.val_sz = sizeof(val); > >> + > >> + pmr = odp_cls_pmr_create(&match, 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); > >> @@ -1005,7 +954,7 @@ static void classification_test_pmr_pool_set(void) > >> > >> odp_cos_destroy(cos); > >> odp_cos_destroy(default_cos); > >> - odp_pmr_destroy(pmr); > >> + odp_cls_pmr_destroy(pmr); > >> destroy_inq(pktio); > >> odp_pool_destroy(default_pool); > >> odp_pool_destroy(pool); > >> @@ -1042,7 +991,7 @@ static void classification_test_pmr_queue_set(void) > >> mask = 0xff; > >> seqno = 0; > >> > >> - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); > >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > >> CU_ASSERT(retval == 0); > >> @@ -1050,14 +999,6 @@ static void > classification_test_pmr_queue_set(void) > >> configure_default_cos(pktio, &default_cos, > >> &default_queue, &default_pool); > >> > >> - match.term = ODP_PMR_IPPROTO; > >> - match.val = &val; > >> - match.mask = &mask; > >> - match.val_sz = sizeof(val); > >> - > >> - pmr = odp_pmr_create(&match); > >> - CU_ASSERT(pmr != ODP_PMR_INVAL); > >> - > >> queue = queue_create("ipproto1", true); > >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > >> > >> @@ -1080,8 +1021,13 @@ static void > classification_test_pmr_queue_set(void) > >> retval = odp_cos_queue_set(cos, queue_new); > >> CU_ASSERT(retval == 0); > >> > >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > >> - CU_ASSERT(retval == 0); > >> + match.term = ODP_PMR_IPPROTO; > >> + match.val = &val; > >> + match.mask = &mask; > >> + match.val_sz = sizeof(val); > >> + > >> + pmr = odp_cls_pmr_create(&match, 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); > >> @@ -1103,7 +1049,7 @@ static void > classification_test_pmr_queue_set(void) > >> > >> odp_cos_destroy(cos); > >> odp_cos_destroy(default_cos); > >> - odp_pmr_destroy(pmr); > >> + odp_cls_pmr_destroy(pmr); > >> destroy_inq(pktio); > >> odp_pool_destroy(default_pool); > >> odp_pool_destroy(pool); > >> @@ -1136,22 +1082,13 @@ 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); > >> + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); > >> retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); > >> CU_ASSERT(retval == 0); > >> > >> configure_default_cos(pktio, &default_cos, > >> &default_queue, &default_pool); > >> > >> - parse_ipv4_string(dst_addr, &addr, &mask); > >> - match.term = ODP_PMR_DIP_ADDR; > >> - match.val = &addr; > >> - match.mask = &mask; > >> - match.val_sz = sizeof(addr); > >> - > >> - pmr = odp_pmr_create(&match); > >> - CU_ASSERT_FATAL(pmr != ODP_PMR_INVAL); > >> - > >> queue = queue_create("daddr", true); > >> CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); > >> > >> @@ -1167,8 +1104,14 @@ static void > >> classification_test_pmr_term_daddr(void) > >> cos = odp_cls_cos_create(cosname, &cls_param); > >> CU_ASSERT_FATAL(cos != ODP_COS_INVALID); > >> > >> - retval = odp_pktio_pmr_cos(pmr, pktio, cos); > >> - CU_ASSERT(retval == 0); > >> + parse_ipv4_string(dst_addr, &addr, &mask); > >> + match.term = ODP_PMR_DIP_ADDR; > >> + match.val = &addr; > >> + match.mask = &mask; > >> + match.val_sz = sizeof(addr); > >> + > >> + pmr = odp_cls_pmr_create(&match, 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*/ > >> @@ -1208,7 +1151,7 @@ static void > classification_test_pmr_term_daddr(void) > >> > >> odp_cos_destroy(cos); > >> odp_cos_destroy(default_cos); > >> - odp_pmr_destroy(pmr); > >> + odp_cls_pmr_destroy(pmr); > >> odp_packet_free(pkt); > >> destroy_inq(pktio); > >> odp_pool_destroy(default_pool); > >> diff --git a/test/validation/classification/odp_classification_tests.c > >> b/test/validation/classification/odp_classification_tests.c > >> index a118728..a468908 100644 > >> --- a/test/validation/classification/odp_classification_tests.c > >> +++ b/test/validation/classification/odp_classification_tests.c > >> @@ -16,7 +16,6 @@ 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_pmr_set_t pmr_set; > >> > >> static odp_pool_t pool_default; > >> static odp_pktio_t pktio_loop; > >> @@ -107,7 +106,7 @@ int classification_suite_term(void) > >> odp_cos_destroy(cos_list[i]); > >> > >> for (i = 0; i < CLS_ENTRIES; i++) > >> - odp_pmr_destroy(pmr_list[i]); > >> + odp_cls_pmr_destroy(pmr_list[i]); > >> > >> for (i = 0; i < CLS_ENTRIES; i++) > >> odp_queue_destroy(queue_list[i]); > >> @@ -128,7 +127,6 @@ void configure_cls_pmr_chain(void) > >> > >> uint16_t val; > >> uint16_t maskport; > >> - int retval; > >> char cosname[ODP_QUEUE_NAME_LEN]; > >> odp_queue_param_t qparam; > >> odp_cls_cos_param_t cls_param; > >> @@ -193,7 +191,9 @@ void configure_cls_pmr_chain(void) > >> match.val = &addr; > >> match.mask = &mask; > >> match.val_sz = sizeof(addr); > >> - pmr_list[CLS_PMR_CHAIN_SRC] = odp_pmr_create(&match); > >> + pmr_list[CLS_PMR_CHAIN_SRC] = > >> + odp_cls_pmr_create(&match, 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; > >> @@ -202,17 +202,10 @@ void configure_cls_pmr_chain(void) > >> match.val = &val; > >> match.mask = &maskport; > >> match.val_sz = sizeof(val); > >> - pmr_list[CLS_PMR_CHAIN_DST] = odp_pmr_create(&match); > >> + pmr_list[CLS_PMR_CHAIN_DST] = > >> + odp_cls_pmr_create(&match, 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); > >> - > >> - retval = odp_pktio_pmr_cos(pmr_list[CLS_PMR_CHAIN_SRC], > >> pktio_loop, > >> - cos_list[CLS_PMR_CHAIN_SRC]); > >> - CU_ASSERT(retval == 0); > >> - > >> - retval = odp_cos_pmr_cos(pmr_list[CLS_PMR_CHAIN_DST], > >> - cos_list[CLS_PMR_CHAIN_SRC], > >> - cos_list[CLS_PMR_CHAIN_DST]); > >> - CU_ASSERT(retval == 0); > >> } > >> > >> void test_cls_pmr_chain(void) > >> @@ -504,7 +497,6 @@ void configure_pmr_cos(void) > >> { > >> uint16_t val; > >> uint16_t mask; > >> - int retval; > >> odp_pmr_match_t match; > >> odp_queue_param_t qparam; > >> odp_cls_cos_param_t cls_param; > >> @@ -512,16 +504,6 @@ void configure_pmr_cos(void) > >> char queuename[ODP_QUEUE_NAME_LEN]; > >> char poolname[ODP_POOL_NAME_LEN]; > >> > >> - 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_pmr_create(&match); > >> - CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); > >> - > >> odp_queue_param_init(&qparam); > >> qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; > >> qparam.sched.sync = ODP_SCHED_SYNC_NONE; > >> @@ -545,9 +527,16 @@ void configure_pmr_cos(void) > >> cos_list[CLS_PMR] = odp_cls_cos_create(cosname, &cls_param); > >> CU_ASSERT_FATAL(cos_list[CLS_PMR] != ODP_COS_INVALID); > >> > >> - retval = odp_pktio_pmr_cos(pmr_list[CLS_PMR], pktio_loop, > >> - cos_list[CLS_PMR]); > >> - CU_ASSERT(retval == 0); > >> + 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], > >> + cos_list[CLS_PMR]); > >> + CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); > >> } > >> > >> void test_pmr_cos(void) > >> @@ -572,9 +561,8 @@ void test_pmr_cos(void) > >> odp_packet_free(pkt); > >> } > >> > >> -void configure_pktio_pmr_match_set_cos(void) > >> +void configure_pktio_pmr_composite(void) > >> { > >> - int retval; > >> odp_pmr_match_t pmr_terms[2]; > >> uint16_t val; > >> uint16_t maskport; > >> @@ -587,23 +575,6 @@ void configure_pktio_pmr_match_set_cos(void) > >> uint32_t addr = 0; > >> uint32_t mask; > >> > >> - 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); > >> - > >> - > >> - 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); > >> - > >> - retval = odp_pmr_match_set_create(num_terms, pmr_terms, > &pmr_set); > >> - CU_ASSERT(retval > 0); > >> - > >> odp_queue_param_init(&qparam); > >> qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; > >> qparam.sched.sync = ODP_SCHED_SYNC_NONE; > >> @@ -627,9 +598,23 @@ void configure_pktio_pmr_match_set_cos(void) > >> cos_list[CLS_PMR_SET] = odp_cls_cos_create(cosname, &cls_param); > >> CU_ASSERT_FATAL(cos_list[CLS_PMR_SET] != ODP_COS_INVALID); > >> > >> - retval = odp_pktio_pmr_match_set_cos(pmr_set, pktio_loop, > >> - cos_list[CLS_PMR_SET]); > >> - CU_ASSERT(retval == 0); > >> + 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); > >> + > >> + 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, > >> + > cos_list[CLS_DEFAULT], > >> + > cos_list[CLS_PMR_SET]); > >> + CU_ASSERT_FATAL(pmr_list[CLS_PMR_SET] != ODP_PMR_INVAL); > >> } > >> > >> void test_pktio_pmr_match_set_cos(void) > >> @@ -695,7 +680,7 @@ void classification_test_pktio_configure(void) > >> if (TEST_PMR) > >> configure_pmr_cos(); > >> if (TEST_PMR_SET) > >> - configure_pktio_pmr_match_set_cos(); > >> + configure_pktio_pmr_composite(); > >> } > >> > >> void classification_test_pktio_test(void) > >> diff --git > >> a/test/validation/classification/odp_classification_testsuites.h > >> b/test/validation/classification/odp_classification_testsuites.h > >> index 19d5ae2..851f0a3 100644 > >> --- a/test/validation/classification/odp_classification_testsuites.h > >> +++ b/test/validation/classification/odp_classification_testsuites.h > >> @@ -27,7 +27,7 @@ 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_pktio_t create_pktio(odp_queue_type_t q_type, odp_pool_t pool); > >> int create_default_inq(odp_pktio_t pktio, odp_queue_type_t qtype); > >> void configure_default_cos(odp_pktio_t pktio, odp_cos_t *cos, > >> odp_queue_t *queue, odp_pool_t *pool); > >> @@ -46,7 +46,7 @@ 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_match_set_cos(void); > >> +void configure_pktio_pmr_composite(void); > >> void test_pktio_pmr_match_set_cos(void); > >> int destroy_inq(odp_pktio_t pktio); > >> odp_pmr_term_t find_first_supported_l3_pmr(void); > >> -- > >> 1.9.1 > >> > >> _______________________________________________ > >> lng-odp mailing list > >> lng-odp@lists.linaro.org > >> https://lists.linaro.org/mailman/listinfo/lng-odp > > > > >
diff --git a/test/validation/classification/classification.h b/test/validation/classification/classification.h index 5508af7..c987cca 100644 --- a/test/validation/classification/classification.h +++ b/test/validation/classification/classification.h @@ -59,7 +59,6 @@ void classification_test_create_cos(void); void classification_test_destroy_cos(void); void classification_test_create_pmr_match(void); -void classification_test_destroy_pmr(void); void classification_test_cos_set_queue(void); void classification_test_cos_set_pool(void); void classification_test_cos_set_drop(void); diff --git a/test/validation/classification/odp_classification_basic.c b/test/validation/classification/odp_classification_basic.c index 81077b6..1336955 100644 --- a/test/validation/classification/odp_classification_basic.c +++ b/test/validation/classification/odp_classification_basic.c @@ -74,28 +74,40 @@ void classification_test_create_pmr_match(void) odp_pmr_t pmr; uint16_t val; uint16_t mask; + int retval; odp_pmr_match_t match; + 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; - val = 1024; - mask = 0xffff; - match.term = find_first_supported_l3_pmr(); - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); + pkt_pool = pool_create("pkt_pool"); + CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID); - pmr = odp_pmr_create(&match); - CU_ASSERT(pmr != ODP_PMR_INVAL); - CU_ASSERT(odp_pmr_to_u64(pmr) != odp_pmr_to_u64(ODP_PMR_INVAL)); - odp_pmr_destroy(pmr); -} + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); -void classification_test_destroy_pmr(void) -{ - odp_pmr_t pmr; - uint16_t val; - uint16_t mask; - int retval; - odp_pmr_match_t match; + 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; @@ -104,12 +116,25 @@ void classification_test_destroy_pmr(void) match.mask = &mask; match.val_sz = sizeof(val); - pmr = odp_pmr_create(&match); - retval = odp_pmr_destroy(pmr); + pmr = odp_cls_pmr_create(&match, 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); - retval = odp_pmr_destroy(ODP_PMR_INVAL); - retval = odp_pmr_destroy(ODP_PMR_INVAL); + + /* 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); } void classification_test_cos_set_queue(void) @@ -224,39 +249,44 @@ void classification_test_cos_set_drop(void) void classification_test_pmr_match_set_create(void) { - odp_pmr_set_t pmr_set; + odp_pmr_t pmr_set; int retval; odp_pmr_match_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; - for (i = 0; i < PMR_SET_NUM; i++) { - pmr_terms[i].term = ODP_PMR_TCP_DPORT; - pmr_terms[i].val = &val; - pmr_terms[i].mask = &mask; - pmr_terms[i].val_sz = sizeof(val); - } - retval = odp_pmr_match_set_create(PMR_SET_NUM, pmr_terms, &pmr_set); - CU_ASSERT(retval > 0); - CU_ASSERT(odp_pmr_set_to_u64(pmr_set) != - odp_pmr_set_to_u64(ODP_PMR_SET_INVAL)); + pkt_pool = pool_create("pkt_pool"); + CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID); - retval = odp_pmr_match_set_destroy(pmr_set); - CU_ASSERT(retval == 0); -} + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); -void classification_test_pmr_match_set_destroy(void) -{ - odp_pmr_set_t pmr_set; - int retval; - odp_pmr_match_t pmr_terms[PMR_SET_NUM]; - uint16_t val = 1024; - uint16_t mask = 0xffff; - int i; + configure_default_cos(pktio, &default_cos, + &default_queue, &default_pool); - retval = odp_pmr_match_set_destroy(ODP_PMR_SET_INVAL); - CU_ASSERT(retval < 0); + 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++) { pmr_terms[i].term = ODP_PMR_TCP_DPORT; @@ -265,22 +295,31 @@ void classification_test_pmr_match_set_destroy(void) pmr_terms[i].val_sz = sizeof(val); } - retval = odp_pmr_match_set_create(PMR_SET_NUM, pmr_terms, &pmr_set); - CU_ASSERT(retval > 0); + pmr_set = odp_cls_pmr_create(pmr_terms, PMR_SET_NUM, + default_cos, cos); + CU_ASSERT(odp_pmr_to_u64(pmr_set) != + odp_pmr_to_u64(ODP_PMR_INVAL)); - retval = odp_pmr_match_set_destroy(pmr_set); + retval = odp_cls_pmr_destroy(pmr_set); 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_destroy_pmr), 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_match_set_create), - ODP_TEST_INFO(classification_test_pmr_match_set_destroy), ODP_TEST_INFO_NULL, }; diff --git a/test/validation/classification/odp_classification_common.c b/test/validation/classification/odp_classification_common.c index 70d21a2..8a8506a 100644 --- a/test/validation/classification/odp_classification_common.c +++ b/test/validation/classification/odp_classification_common.c @@ -17,6 +17,32 @@ 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 pktio; + odp_pktio_param_t pktio_param; + int ret; + + if (pool == ODP_POOL_INVALID) + return ODP_PKTIO_INVALID; + + odp_pktio_param_init(&pktio_param); + if (q_type == ODP_QUEUE_TYPE_POLL) + pktio_param.in_mode = ODP_PKTIN_MODE_POLL; + 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; + } + + return pktio; +} + int destroy_inq(odp_pktio_t pktio) { odp_queue_t inq; diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c index 9e6a9e2..02cb825 100644 --- a/test/validation/classification/odp_classification_test_pmr.c +++ b/test/validation/classification/odp_classification_test_pmr.c @@ -29,32 +29,6 @@ int classification_suite_pmr_init(void) return 0; } -odp_pktio_t create_pktio(odp_queue_type_t q_type) -{ - odp_pktio_t pktio; - odp_pktio_param_t pktio_param; - int ret; - - if (pkt_pool == ODP_POOL_INVALID) - return ODP_PKTIO_INVALID; - - odp_pktio_param_init(&pktio_param); - if (q_type == ODP_QUEUE_TYPE_POLL) - pktio_param.in_mode = ODP_PKTIN_MODE_POLL; - else - pktio_param.in_mode = ODP_PKTIN_MODE_SCHED; - - pktio = odp_pktio_open("loop", pkt_pool, &pktio_param); - if (pktio == ODP_PKTIO_INVALID) { - ret = odp_pool_destroy(pkt_pool); - if (ret) - fprintf(stderr, "unable to destroy pool.\n"); - return ODP_PKTIO_INVALID; - } - - return pktio; -} - int create_default_inq(odp_pktio_t pktio, odp_queue_type_t qtype) { odp_queue_param_t qparam; @@ -162,7 +136,7 @@ void classification_test_pmr_term_tcp_dport(void) mask = 0xffff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); CU_ASSERT(retval == 0); @@ -170,15 +144,6 @@ void classification_test_pmr_term_tcp_dport(void) configure_default_cos(pktio, &default_cos, &default_queue, &default_pool); - match.term = ODP_PMR_TCP_DPORT; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); - - pmr = odp_pmr_create(&match); - CU_ASSERT(pmr != ODP_PMR_INVAL); - - queue = queue_create("tcp_dport1", true); CU_ASSERT(queue != ODP_QUEUE_INVALID); @@ -194,8 +159,13 @@ void classification_test_pmr_term_tcp_dport(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT(cos != ODP_COS_INVALID); - retval = odp_pktio_pmr_cos(pmr, pktio, cos); - CU_ASSERT(retval == 0); + match.term = ODP_PMR_TCP_DPORT; + match.val = &val; + match.mask = &mask; + match.val_sz = sizeof(val); + + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); + CU_ASSERT(pmr != ODP_PMR_INVAL); pkt = create_packet(pkt_pool, false, &seq, false); CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); @@ -243,7 +213,7 @@ void classification_test_pmr_term_tcp_dport(void) odp_packet_free(pkt); odp_cos_destroy(cos); odp_cos_destroy(default_cos); - odp_pmr_destroy(pmr); + odp_cls_pmr_destroy(pmr); destroy_inq(pktio); odp_queue_destroy(queue); odp_queue_destroy(default_queue); @@ -279,7 +249,7 @@ void classification_test_pmr_term_tcp_sport(void) mask = 0xffff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); CU_ASSERT(retval == 0); @@ -287,14 +257,6 @@ void classification_test_pmr_term_tcp_sport(void) configure_default_cos(pktio, &default_cos, &default_queue, &default_pool); - match.term = ODP_PMR_TCP_SPORT; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); - - pmr = odp_pmr_create(&match); - CU_ASSERT(pmr != ODP_PMR_INVAL); - queue = queue_create("tcp_sport", true); CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); @@ -310,8 +272,13 @@ void classification_test_pmr_term_tcp_sport(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - retval = odp_pktio_pmr_cos(pmr, pktio, cos); - CU_ASSERT(retval == 0); + match.term = ODP_PMR_TCP_SPORT; + match.val = &val; + match.mask = &mask; + match.val_sz = sizeof(val); + + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); + CU_ASSERT(pmr != ODP_PMR_INVAL); pkt = create_packet(pkt_pool, false, &seq, false); CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); @@ -357,7 +324,7 @@ void classification_test_pmr_term_tcp_sport(void) odp_packet_free(pkt); odp_cos_destroy(cos); odp_cos_destroy(default_cos); - odp_pmr_destroy(pmr); + odp_cls_pmr_destroy(pmr); destroy_inq(pktio); odp_pool_destroy(default_pool); odp_pool_destroy(pool); @@ -393,7 +360,7 @@ void classification_test_pmr_term_udp_dport(void) mask = 0xffff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); CU_ASSERT(retval == 0); @@ -401,14 +368,6 @@ void classification_test_pmr_term_udp_dport(void) configure_default_cos(pktio, &default_cos, &default_queue, &default_pool); - match.term = ODP_PMR_UDP_DPORT; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); - - pmr = odp_pmr_create(&match); - CU_ASSERT(pmr != ODP_PMR_INVAL); - queue = queue_create("udp_dport", true); CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); @@ -424,8 +383,13 @@ void classification_test_pmr_term_udp_dport(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - retval = odp_pktio_pmr_cos(pmr, pktio, cos); - CU_ASSERT(retval == 0); + match.term = ODP_PMR_UDP_DPORT; + match.val = &val; + match.mask = &mask; + match.val_sz = sizeof(val); + + pmr = odp_cls_pmr_create(&match, 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); @@ -472,7 +436,7 @@ void classification_test_pmr_term_udp_dport(void) odp_packet_free(pkt); odp_cos_destroy(cos); odp_cos_destroy(default_cos); - odp_pmr_destroy(pmr); + odp_cls_pmr_destroy(pmr); destroy_inq(pktio); odp_queue_destroy(queue); odp_queue_destroy(default_queue); @@ -508,7 +472,7 @@ void classification_test_pmr_term_udp_sport(void) mask = 0xffff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); CU_ASSERT(retval == 0); @@ -516,14 +480,6 @@ void classification_test_pmr_term_udp_sport(void) configure_default_cos(pktio, &default_cos, &default_queue, &default_pool); - match.term = ODP_PMR_UDP_SPORT; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); - - pmr = odp_pmr_create(&match); - CU_ASSERT(pmr != ODP_PMR_INVAL); - queue = queue_create("udp_sport", true); CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); @@ -539,8 +495,13 @@ void classification_test_pmr_term_udp_sport(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - retval = odp_pktio_pmr_cos(pmr, pktio, cos); - CU_ASSERT(retval == 0); + match.term = ODP_PMR_UDP_SPORT; + match.val = &val; + match.mask = &mask; + match.val_sz = sizeof(val); + + pmr = odp_cls_pmr_create(&match, 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); @@ -586,7 +547,7 @@ void classification_test_pmr_term_udp_sport(void) odp_cos_destroy(cos); odp_cos_destroy(default_cos); - odp_pmr_destroy(pmr); + odp_cls_pmr_destroy(pmr); destroy_inq(pktio); odp_pool_destroy(default_pool); odp_pool_destroy(pool); @@ -621,7 +582,7 @@ void classification_test_pmr_term_ipproto(void) mask = 0xff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); CU_ASSERT(retval == 0); @@ -629,14 +590,6 @@ void classification_test_pmr_term_ipproto(void) configure_default_cos(pktio, &default_cos, &default_queue, &default_pool); - match.term = ODP_PMR_IPPROTO; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); - - pmr = odp_pmr_create(&match); - CU_ASSERT(pmr != ODP_PMR_INVAL); - queue = queue_create("ipproto", true); CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); @@ -652,8 +605,13 @@ void classification_test_pmr_term_ipproto(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - retval = odp_pktio_pmr_cos(pmr, pktio, cos); - CU_ASSERT(retval == 0); + match.term = ODP_PMR_IPPROTO; + match.val = &val; + match.mask = &mask; + match.val_sz = sizeof(val); + + pmr = odp_cls_pmr_create(&match, 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); @@ -693,7 +651,7 @@ void classification_test_pmr_term_ipproto(void) odp_cos_destroy(cos); odp_cos_destroy(default_cos); - odp_pmr_destroy(pmr); + odp_cls_pmr_destroy(pmr); odp_packet_free(pkt); destroy_inq(pktio); odp_pool_destroy(default_pool); @@ -729,7 +687,7 @@ void classification_test_pmr_term_dmac(void) mask = 0xffffffffffff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); CU_ASSERT(retval == 0); @@ -737,14 +695,6 @@ void classification_test_pmr_term_dmac(void) configure_default_cos(pktio, &default_cos, &default_queue, &default_pool); - match.term = ODP_PMR_DMAC; - match.val = &val; - match.mask = &mask; - match.val_sz = ODPH_ETHADDR_LEN; - - pmr = odp_pmr_create(&match); - CU_ASSERT(pmr != ODP_PMR_INVAL); - queue = queue_create("dmac", true); CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); @@ -760,8 +710,13 @@ void classification_test_pmr_term_dmac(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - retval = odp_pktio_pmr_cos(pmr, pktio, cos); - CU_ASSERT(retval == 0); + match.term = ODP_PMR_DMAC; + match.val = &val; + match.mask = &mask; + match.val_sz = ODPH_ETHADDR_LEN; + + pmr = odp_cls_pmr_create(&match, 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); @@ -797,7 +752,7 @@ void classification_test_pmr_term_dmac(void) odp_cos_destroy(cos); odp_cos_destroy(default_cos); - odp_pmr_destroy(pmr); + odp_cls_pmr_destroy(pmr); odp_packet_free(pkt); destroy_inq(pktio); odp_pool_destroy(default_pool); @@ -834,7 +789,7 @@ void classification_test_pmr_term_packet_len(void) mask = 0xff00; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); CU_ASSERT(retval == 0); @@ -842,14 +797,6 @@ void classification_test_pmr_term_packet_len(void) configure_default_cos(pktio, &default_cos, &default_queue, &default_pool); - match.term = ODP_PMR_LEN; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); - - pmr = odp_pmr_create(&match); - CU_ASSERT(pmr != ODP_PMR_INVAL); - queue = queue_create("packet_len", true); CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); @@ -865,8 +812,13 @@ void classification_test_pmr_term_packet_len(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - retval = odp_pktio_pmr_cos(pmr, pktio, cos); - CU_ASSERT(retval == 0); + match.term = ODP_PMR_LEN; + match.val = &val; + match.mask = &mask; + match.val_sz = sizeof(val); + + pmr = odp_cls_pmr_create(&match, 1, default_cos, cos); + CU_ASSERT(pmr != ODP_PMR_INVAL); /* create packet of payload length 1024 */ pkt = create_packet_len(pkt_pool, false, &seq, true, 1024); @@ -907,7 +859,7 @@ void classification_test_pmr_term_packet_len(void) odp_cos_destroy(cos); odp_cos_destroy(default_cos); - odp_pmr_destroy(pmr); + odp_cls_pmr_destroy(pmr); odp_packet_free(pkt); destroy_inq(pktio); odp_pool_destroy(default_pool); @@ -944,7 +896,7 @@ static void classification_test_pmr_pool_set(void) mask = 0xff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); CU_ASSERT(retval == 0); @@ -952,14 +904,6 @@ static void classification_test_pmr_pool_set(void) configure_default_cos(pktio, &default_cos, &default_queue, &default_pool); - match.term = ODP_PMR_IPPROTO; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); - - pmr = odp_pmr_create(&match); - CU_ASSERT(pmr != ODP_PMR_INVAL); - queue = queue_create("ipproto1", true); CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); @@ -982,8 +926,13 @@ static void classification_test_pmr_pool_set(void) retval = odp_cls_cos_pool_set(cos, pool_new); CU_ASSERT(retval == 0); - retval = odp_pktio_pmr_cos(pmr, pktio, cos); - CU_ASSERT(retval == 0); + match.term = ODP_PMR_IPPROTO; + match.val = &val; + match.mask = &mask; + match.val_sz = sizeof(val); + + pmr = odp_cls_pmr_create(&match, 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); @@ -1005,7 +954,7 @@ static void classification_test_pmr_pool_set(void) odp_cos_destroy(cos); odp_cos_destroy(default_cos); - odp_pmr_destroy(pmr); + odp_cls_pmr_destroy(pmr); destroy_inq(pktio); odp_pool_destroy(default_pool); odp_pool_destroy(pool); @@ -1042,7 +991,7 @@ static void classification_test_pmr_queue_set(void) mask = 0xff; seqno = 0; - pktio = create_pktio(ODP_QUEUE_TYPE_SCHED); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); CU_ASSERT(retval == 0); @@ -1050,14 +999,6 @@ static void classification_test_pmr_queue_set(void) configure_default_cos(pktio, &default_cos, &default_queue, &default_pool); - match.term = ODP_PMR_IPPROTO; - match.val = &val; - match.mask = &mask; - match.val_sz = sizeof(val); - - pmr = odp_pmr_create(&match); - CU_ASSERT(pmr != ODP_PMR_INVAL); - queue = queue_create("ipproto1", true); CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); @@ -1080,8 +1021,13 @@ static void classification_test_pmr_queue_set(void) retval = odp_cos_queue_set(cos, queue_new); CU_ASSERT(retval == 0); - retval = odp_pktio_pmr_cos(pmr, pktio, cos); - CU_ASSERT(retval == 0); + match.term = ODP_PMR_IPPROTO; + match.val = &val; + match.mask = &mask; + match.val_sz = sizeof(val); + + pmr = odp_cls_pmr_create(&match, 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); @@ -1103,7 +1049,7 @@ static void classification_test_pmr_queue_set(void) odp_cos_destroy(cos); odp_cos_destroy(default_cos); - odp_pmr_destroy(pmr); + odp_cls_pmr_destroy(pmr); destroy_inq(pktio); odp_pool_destroy(default_pool); odp_pool_destroy(pool); @@ -1136,22 +1082,13 @@ 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); + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool); retval = create_default_inq(pktio, ODP_QUEUE_TYPE_SCHED); CU_ASSERT(retval == 0); configure_default_cos(pktio, &default_cos, &default_queue, &default_pool); - parse_ipv4_string(dst_addr, &addr, &mask); - match.term = ODP_PMR_DIP_ADDR; - match.val = &addr; - match.mask = &mask; - match.val_sz = sizeof(addr); - - pmr = odp_pmr_create(&match); - CU_ASSERT_FATAL(pmr != ODP_PMR_INVAL); - queue = queue_create("daddr", true); CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); @@ -1167,8 +1104,14 @@ static void classification_test_pmr_term_daddr(void) cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); - retval = odp_pktio_pmr_cos(pmr, pktio, cos); - CU_ASSERT(retval == 0); + parse_ipv4_string(dst_addr, &addr, &mask); + match.term = ODP_PMR_DIP_ADDR; + match.val = &addr; + match.mask = &mask; + match.val_sz = sizeof(addr); + + pmr = odp_cls_pmr_create(&match, 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*/ @@ -1208,7 +1151,7 @@ static void classification_test_pmr_term_daddr(void) odp_cos_destroy(cos); odp_cos_destroy(default_cos); - odp_pmr_destroy(pmr); + odp_cls_pmr_destroy(pmr); odp_packet_free(pkt); destroy_inq(pktio); odp_pool_destroy(default_pool); diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index a118728..a468908 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -16,7 +16,6 @@ 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_pmr_set_t pmr_set; static odp_pool_t pool_default; static odp_pktio_t pktio_loop; @@ -107,7 +106,7 @@ int classification_suite_term(void) odp_cos_destroy(cos_list[i]); for (i = 0; i < CLS_ENTRIES; i++) - odp_pmr_destroy(pmr_list[i]); + odp_cls_pmr_destroy(pmr_list[i]); for (i = 0; i < CLS_ENTRIES; i++) odp_queue_destroy(queue_list[i]); @@ -128,7 +127,6 @@ void configure_cls_pmr_chain(void) uint16_t val; uint16_t maskport; - int retval; char cosname[ODP_QUEUE_NAME_LEN]; odp_queue_param_t qparam; odp_cls_cos_param_t cls_param; @@ -193,7 +191,9 @@ void configure_cls_pmr_chain(void) match.val = &addr; match.mask = &mask; match.val_sz = sizeof(addr); - pmr_list[CLS_PMR_CHAIN_SRC] = odp_pmr_create(&match); + pmr_list[CLS_PMR_CHAIN_SRC] = + odp_cls_pmr_create(&match, 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; @@ -202,17 +202,10 @@ void configure_cls_pmr_chain(void) match.val = &val; match.mask = &maskport; match.val_sz = sizeof(val); - pmr_list[CLS_PMR_CHAIN_DST] = odp_pmr_create(&match); + pmr_list[CLS_PMR_CHAIN_DST] = + odp_cls_pmr_create(&match, 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); - - retval = odp_pktio_pmr_cos(pmr_list[CLS_PMR_CHAIN_SRC], pktio_loop, - cos_list[CLS_PMR_CHAIN_SRC]); - CU_ASSERT(retval == 0); - - retval = odp_cos_pmr_cos(pmr_list[CLS_PMR_CHAIN_DST], - cos_list[CLS_PMR_CHAIN_SRC], - cos_list[CLS_PMR_CHAIN_DST]); - CU_ASSERT(retval == 0); } void test_cls_pmr_chain(void) @@ -504,7 +497,6 @@ void configure_pmr_cos(void) { uint16_t val; uint16_t mask; - int retval; odp_pmr_match_t match; odp_queue_param_t qparam; odp_cls_cos_param_t cls_param; @@ -512,16 +504,6 @@ void configure_pmr_cos(void) char queuename[ODP_QUEUE_NAME_LEN]; char poolname[ODP_POOL_NAME_LEN]; - 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_pmr_create(&match); - CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); - odp_queue_param_init(&qparam); qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; qparam.sched.sync = ODP_SCHED_SYNC_NONE; @@ -545,9 +527,16 @@ void configure_pmr_cos(void) cos_list[CLS_PMR] = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos_list[CLS_PMR] != ODP_COS_INVALID); - retval = odp_pktio_pmr_cos(pmr_list[CLS_PMR], pktio_loop, - cos_list[CLS_PMR]); - CU_ASSERT(retval == 0); + 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], + cos_list[CLS_PMR]); + CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); } void test_pmr_cos(void) @@ -572,9 +561,8 @@ void test_pmr_cos(void) odp_packet_free(pkt); } -void configure_pktio_pmr_match_set_cos(void) +void configure_pktio_pmr_composite(void) { - int retval; odp_pmr_match_t pmr_terms[2]; uint16_t val; uint16_t maskport; @@ -587,23 +575,6 @@ void configure_pktio_pmr_match_set_cos(void) uint32_t addr = 0; uint32_t mask; - 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); - - - 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); - - retval = odp_pmr_match_set_create(num_terms, pmr_terms, &pmr_set); - CU_ASSERT(retval > 0); - odp_queue_param_init(&qparam); qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; qparam.sched.sync = ODP_SCHED_SYNC_NONE; @@ -627,9 +598,23 @@ void configure_pktio_pmr_match_set_cos(void) cos_list[CLS_PMR_SET] = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos_list[CLS_PMR_SET] != ODP_COS_INVALID); - retval = odp_pktio_pmr_match_set_cos(pmr_set, pktio_loop, - cos_list[CLS_PMR_SET]); - CU_ASSERT(retval == 0); + 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); + + 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, + cos_list[CLS_DEFAULT], + cos_list[CLS_PMR_SET]); + CU_ASSERT_FATAL(pmr_list[CLS_PMR_SET] != ODP_PMR_INVAL); } void test_pktio_pmr_match_set_cos(void) @@ -695,7 +680,7 @@ void classification_test_pktio_configure(void) if (TEST_PMR) configure_pmr_cos(); if (TEST_PMR_SET) - configure_pktio_pmr_match_set_cos(); + configure_pktio_pmr_composite(); } void classification_test_pktio_test(void) diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h index 19d5ae2..851f0a3 100644 --- a/test/validation/classification/odp_classification_testsuites.h +++ b/test/validation/classification/odp_classification_testsuites.h @@ -27,7 +27,7 @@ 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_pktio_t create_pktio(odp_queue_type_t q_type, odp_pool_t pool); int create_default_inq(odp_pktio_t pktio, odp_queue_type_t qtype); void configure_default_cos(odp_pktio_t pktio, odp_cos_t *cos, odp_queue_t *queue, odp_pool_t *pool); @@ -46,7 +46,7 @@ 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_match_set_cos(void); +void configure_pktio_pmr_composite(void); void test_pktio_pmr_match_set_cos(void); int destroy_inq(odp_pktio_t pktio); odp_pmr_term_t find_first_supported_l3_pmr(void);
Adds validation suite for packet match rule create functions. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> --- test/validation/classification/classification.h | 1 - .../classification/odp_classification_basic.c | 141 +++++++----- .../classification/odp_classification_common.c | 26 +++ .../classification/odp_classification_test_pmr.c | 239 ++++++++------------- .../classification/odp_classification_tests.c | 87 ++++---- .../classification/odp_classification_testsuites.h | 4 +- 6 files changed, 245 insertions(+), 253 deletions(-)