diff mbox

[API-NEXT,PATCHv2,3/4] validation: classification: adds validation suite for pmr create api

Message ID 1454331360-16717-3-git-send-email-bala.manoharan@linaro.org
State Superseded
Headers show

Commit Message

Balasubramanian Manoharan Feb. 1, 2016, 12:55 p.m. UTC
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      |  83 +++----
 .../classification/odp_classification_testsuites.h |   2 +-
 6 files changed, 242 insertions(+), 250 deletions(-)
diff mbox

Patch

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..55f10ac 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(1, &match, 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_SET_NUM, pmr_terms,
+				     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..fea6ce3 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(1, &match, 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(1, &match, 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(1, &match, 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(1, &match, 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(1, &match, 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(1, &match, 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(1, &match, 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(1, &match, 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(1, &match, 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(1, &match, 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..147d761 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(1, &match, 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(1, &match, 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(1, &match, cos_list[CLS_DEFAULT],
+					   cos_list[CLS_PMR]);
+	CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL);
 }
 
 void test_pmr_cos(void)
@@ -574,7 +563,6 @@  void test_pmr_cos(void)
 
 void configure_pktio_pmr_match_set_cos(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(num_terms, pmr_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)
diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h
index 19d5ae2..2b0f170 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);