diff options
Diffstat (limited to 'test/validation/api/classification')
4 files changed, 19 insertions, 236 deletions
diff --git a/test/validation/api/classification/odp_classification_basic.c b/test/validation/api/classification/odp_classification_basic.c index 2eb5c86b1..ca0b58ad5 100644 --- a/test/validation/api/classification/odp_classification_basic.c +++ b/test/validation/api/classification/odp_classification_basic.c @@ -9,8 +9,6 @@ #include "odp_classification_testsuites.h" #include "classification.h" -#define PMR_SET_NUM 5 - /* Limit handle array allocation from stack to about 256kB */ #define MAX_HANDLES (32 * 1024) @@ -56,9 +54,6 @@ static void cls_create_cos(void) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos = odp_cls_cos_create(NULL, &cls_param); CU_ASSERT(odp_cos_to_u64(cos) != odp_cos_to_u64(ODP_COS_INVALID)); @@ -203,9 +198,6 @@ static void cls_destroy_cos(void) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos = odp_cls_cos_create(name, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); @@ -253,9 +245,6 @@ static void cls_create_pmr_match(void) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos = odp_cls_cos_create("pmr_match", &cls_param); CU_ASSERT(cos != ODP_COS_INVALID); @@ -330,7 +319,7 @@ static void cls_max_pmr_from_default_action(int drop) CU_ASSERT_FATAL(num_cos > 1); - num_pmr = num_cos - 1; + num_pmr = capa.max_pmr_per_cos; odp_cos_t cos[num_cos]; odp_queue_t queue[num_cos]; @@ -388,8 +377,10 @@ static void cls_max_pmr_from_default_action(int drop) for (i = 0; i < num_pmr; i++) { pmr[i] = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos[i + 1]); - if (pmr[i] == ODP_PMR_INVALID) + if (pmr[i] == ODP_PMR_INVALID) { + ODPH_ERR("odp_cls_pmr_create() failed %u / %u\n", i + 1, num_pmr); break; + } val++; pmr_created++; @@ -398,6 +389,8 @@ static void cls_max_pmr_from_default_action(int drop) printf("\n Number of CoS created: %u\n Number of PMR created: %u\n", cos_created, pmr_created); + CU_ASSERT(pmr_created == num_pmr); + for (i = 0; i < pmr_created; i++) CU_ASSERT(odp_cls_pmr_destroy(pmr[i]) == 0); @@ -455,6 +448,8 @@ static void cls_create_pmr_multi(void) CU_ASSERT_FATAL(num_cos > 1); num_pmr = num_cos - 1; + if (num_pmr > capa.max_pmr) + num_pmr = capa.max_pmr; odp_cos_t src_cos[num_cos]; odp_cos_t cos[num_cos]; @@ -561,9 +556,7 @@ static void cls_cos_set_queue(void) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif + cos_queue = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos_queue != ODP_COS_INVALID); @@ -605,9 +598,7 @@ static void cls_cos_set_pool(void) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif + cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); @@ -625,50 +616,11 @@ static void cls_cos_set_pool(void) odp_pool_destroy(cos_pool); } -#if ODP_DEPRECATED_API - -static void cls_cos_set_drop(void) -{ - int retval; - char cosname[ODP_COS_NAME_LEN]; - odp_cos_t cos_drop; - odp_queue_t queue; - odp_pool_t pool; - odp_cls_cos_param_t cls_param; - - pool = pool_create("cls_basic_pool"); - CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); - - queue = queue_create("cls_basic_queue", true); - CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); - - sprintf(cosname, "CoSDrop"); - odp_cls_cos_param_init(&cls_param); - cls_param.pool = pool; - cls_param.queue = queue; - cls_param.drop_policy = ODP_COS_DROP_POOL; - cos_drop = odp_cls_cos_create(cosname, &cls_param); - CU_ASSERT_FATAL(cos_drop != ODP_COS_INVALID); - - retval = odp_cos_drop_set(cos_drop, ODP_COS_DROP_POOL); - CU_ASSERT(retval == 0); - CU_ASSERT(ODP_COS_DROP_POOL == odp_cos_drop(cos_drop)); - - retval = odp_cos_drop_set(cos_drop, ODP_COS_DROP_NEVER); - CU_ASSERT(retval == 0); - CU_ASSERT(ODP_COS_DROP_NEVER == odp_cos_drop(cos_drop)); - odp_cos_destroy(cos_drop); - odp_pool_destroy(pool); - odp_queue_destroy(queue); -} - -#endif - static void cls_pmr_composite_create(void) { + odp_cls_capability_t capa; odp_pmr_t pmr_composite; int retval; - odp_pmr_param_t pmr_terms[PMR_SET_NUM]; odp_cos_t default_cos; odp_cos_t cos; odp_queue_t default_queue; @@ -678,9 +630,11 @@ static void cls_pmr_composite_create(void) odp_pool_t pkt_pool; odp_cls_cos_param_t cls_param; odp_pktio_t pktio; + uint32_t max_terms_per_pmr; uint16_t val = 1024; uint16_t mask = 0xffff; - int i; + + CU_ASSERT_FATAL(odp_cls_capability(&capa) == 0); pkt_pool = pool_create("pkt_pool"); CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID); @@ -700,14 +654,14 @@ static void cls_pmr_composite_create(void) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos = odp_cls_cos_create("pmr_match", &cls_param); CU_ASSERT(cos != ODP_COS_INVALID); - for (i = 0; i < PMR_SET_NUM; i++) { + max_terms_per_pmr = capa.max_terms_per_pmr; + odp_pmr_param_t pmr_terms[max_terms_per_pmr]; + + for (uint32_t i = 0; i < max_terms_per_pmr; i++) { odp_cls_pmr_param_init(&pmr_terms[i]); pmr_terms[i].term = ODP_PMR_TCP_DPORT; pmr_terms[i].match.value = &val; @@ -716,8 +670,7 @@ static void cls_pmr_composite_create(void) pmr_terms[i].val_sz = sizeof(val); } - pmr_composite = odp_cls_pmr_create(pmr_terms, PMR_SET_NUM, - default_cos, cos); + pmr_composite = odp_cls_pmr_create(pmr_terms, max_terms_per_pmr, default_cos, cos); CU_ASSERT(odp_pmr_to_u64(pmr_composite) != odp_pmr_to_u64(ODP_PMR_INVALID)); @@ -793,9 +746,6 @@ odp_testinfo_t classification_suite_basic[] = { ODP_TEST_INFO(cls_max_pmr_from_default_drop), ODP_TEST_INFO(cls_max_pmr_from_default_enqueue), ODP_TEST_INFO(cls_cos_set_queue), -#if ODP_DEPRECATED_API - ODP_TEST_INFO(cls_cos_set_drop), -#endif ODP_TEST_INFO(cls_cos_set_pool), ODP_TEST_INFO(cls_pmr_composite_create), ODP_TEST_INFO_CONDITIONAL(cls_create_cos_with_hash_queues, check_capa_cos_hashing), diff --git a/test/validation/api/classification/odp_classification_test_pmr.c b/test/validation/api/classification/odp_classification_test_pmr.c index b88f7beca..7db0e1b5e 100644 --- a/test/validation/api/classification/odp_classification_test_pmr.c +++ b/test/validation/api/classification/odp_classification_test_pmr.c @@ -77,9 +77,6 @@ void configure_default_cos(odp_pktio_t pktio, odp_cos_t *cos, odp_cls_cos_param_init(&cls_param); cls_param.pool = default_pool; cls_param.queue = default_queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif default_cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT(default_cos != ODP_COS_INVALID); @@ -153,9 +150,6 @@ static void cls_pktin_classifier_flag(void) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT(cos != ODP_COS_INVALID); @@ -250,9 +244,6 @@ static void cls_pmr_term_tcp_dport_n(int num_pkt) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT(cos != ODP_COS_INVALID); @@ -426,9 +417,6 @@ static void test_pmr(const odp_pmr_param_t *pmr_param, odp_packet_t pkt, odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos = odp_cls_cos_create("PMR test cos", &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); @@ -700,9 +688,6 @@ static void cls_pmr_term_dmac(void) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); @@ -1041,9 +1026,6 @@ static void cls_pmr_pool_set(void) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); @@ -1143,9 +1125,6 @@ static void cls_pmr_queue_set(void) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos = odp_cls_cos_create(cosname, &cls_param); CU_ASSERT_FATAL(cos != ODP_COS_INVALID); @@ -1447,9 +1426,6 @@ static void test_pmr_series(const int num_udp, int marking) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue_ip; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos_ip = odp_cls_cos_create("cos_ip", &cls_param); CU_ASSERT_FATAL(cos_ip != ODP_COS_INVALID); @@ -1491,9 +1467,6 @@ static void test_pmr_series(const int num_udp, int marking) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool; cls_param.queue = queue_udp[i]; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif cos_udp[i] = odp_cls_cos_create(name, &cls_param); CU_ASSERT_FATAL(cos_udp[i] != ODP_COS_INVALID); diff --git a/test/validation/api/classification/odp_classification_tests.c b/test/validation/api/classification/odp_classification_tests.c index 008034d9a..d81884006 100644 --- a/test/validation/api/classification/odp_classification_tests.c +++ b/test/validation/api/classification/odp_classification_tests.c @@ -20,10 +20,6 @@ static odp_pktio_t pktio_loop; static odp_pktio_capability_t pktio_capa; static odp_cls_testcase_u tc; -#ifdef ODP_DEPRECATED -static int global_num_l2_qos; -#endif - #define NUM_COS_PMR_CHAIN 2 #define NUM_COS_DEFAULT 1 #define NUM_COS_DROP 1 @@ -262,9 +258,6 @@ void configure_cls_pmr_chain(odp_bool_t enable_pktv) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool_list[CLS_PMR_CHAIN_SRC]; cls_param.queue = queue_list[CLS_PMR_CHAIN_SRC]; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif if (enable_pktv) { cls_param.vector.enable = true; @@ -294,9 +287,6 @@ void configure_cls_pmr_chain(odp_bool_t enable_pktv) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool_list[CLS_PMR_CHAIN_DST]; cls_param.queue = queue_list[CLS_PMR_CHAIN_DST]; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif if (enable_pktv) { cls_param.vector.enable = true; @@ -416,9 +406,6 @@ void configure_pktio_default_cos(odp_bool_t enable_pktv) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool_list[CLS_DEFAULT]; cls_param.queue = queue_list[CLS_DEFAULT]; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif if (enable_pktv) { cls_param.vector.enable = true; @@ -632,9 +619,6 @@ void configure_pktio_error_cos(odp_bool_t enable_pktv) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool_list[CLS_ERROR]; cls_param.queue = queue_list[CLS_ERROR]; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif if (enable_pktv) { cls_param.vector.enable = true; @@ -709,110 +693,6 @@ static void cls_pktio_set_headroom(void) CU_ASSERT(retval < 0); } -#ifdef ODP_DEPRECATED - -void configure_cos_with_l2_priority(odp_bool_t enable_pktv) -{ - uint8_t num_qos = CLS_L2_QOS_MAX; - odp_cos_t cos_tbl[CLS_L2_QOS_MAX]; - odp_queue_t queue_tbl[CLS_L2_QOS_MAX]; - odp_pool_t pool; - uint8_t qos_tbl[CLS_L2_QOS_MAX]; - char cosname[ODP_COS_NAME_LEN]; - char queuename[ODP_QUEUE_NAME_LEN]; - char poolname[ODP_POOL_NAME_LEN]; - int retval; - int i; - odp_queue_param_t qparam; - odp_cls_cos_param_t cls_param; - - /** Initialize scalar variable qos_tbl **/ - for (i = 0; i < CLS_L2_QOS_MAX; i++) - qos_tbl[i] = 0; - - if (odp_schedule_num_prio() < num_qos) - num_qos = odp_schedule_num_prio(); - - global_num_l2_qos = num_qos; - - odp_queue_param_init(&qparam); - qparam.type = ODP_QUEUE_TYPE_SCHED; - qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; - qparam.sched.group = ODP_SCHED_GROUP_ALL; - for (i = 0; i < num_qos; i++) { - qparam.sched.prio = odp_schedule_min_prio() + i; - sprintf(queuename, "%s_%d", "L2_Queue", i); - queue_tbl[i] = odp_queue_create(queuename, &qparam); - CU_ASSERT_FATAL(queue_tbl[i] != ODP_QUEUE_INVALID); - queue_list[CLS_L2_QOS_0 + i] = queue_tbl[i]; - - sprintf(poolname, "%s_%d", "L2_Pool", i); - pool = pool_create(poolname); - CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); - pool_list[CLS_L2_QOS_0 + i] = pool; - - sprintf(cosname, "%s_%d", "L2_Cos", i); - odp_cls_cos_param_init(&cls_param); - cls_param.pool = pool; - cls_param.queue = queue_tbl[i]; - cls_param.drop_policy = ODP_COS_DROP_POOL; - - if (enable_pktv) { - cls_param.vector.enable = true; - cls_param.vector.pool = pktv_config.pool; - cls_param.vector.max_size = pktv_config.max_size; - cls_param.vector.max_tmo_ns = pktv_config.max_tmo_ns; - } - - cos_tbl[i] = odp_cls_cos_create(cosname, &cls_param); - if (cos_tbl[i] == ODP_COS_INVALID) - break; - - cos_list[CLS_L2_QOS_0 + i] = cos_tbl[i]; - qos_tbl[i] = i; - } - /* count 'i' is passed instead of num_qos to handle the rare scenario - if the odp_cls_cos_create() failed in the middle*/ - retval = odp_cos_with_l2_priority(pktio_loop, i, qos_tbl, cos_tbl); - CU_ASSERT(retval == 0); -} - -void test_cos_with_l2_priority(odp_bool_t enable_pktv) -{ - odp_packet_t pkt; - odph_ethhdr_t *ethhdr; - odph_vlanhdr_t *vlan; - odp_queue_t queue; - odp_pool_t pool; - uint32_t seqno = 0; - cls_packet_info_t pkt_info; - uint8_t i; - - pkt_info = default_pkt_info; - pkt_info.l4_type = CLS_PKT_L4_UDP; - pkt_info.vlan = true; - - for (i = 0; i < global_num_l2_qos; i++) { - pkt = create_packet(pkt_info); - CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); - seqno = cls_pkt_get_seq(pkt); - CU_ASSERT(seqno != TEST_SEQ_INVALID); - ethhdr = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); - vlan = (odph_vlanhdr_t *)(ethhdr + 1); - vlan->tci = odp_cpu_to_be_16(i << 13); - enqueue_pktio_interface(pkt, pktio_loop); - pkt = receive_packet(&queue, ODP_TIME_SEC_IN_NS, enable_pktv); - CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); - CU_ASSERT(queue == queue_list[CLS_L2_QOS_0 + i]); - pool = odp_packet_pool(pkt); - CU_ASSERT(pool == pool_list[CLS_L2_QOS_0 + i]); - CU_ASSERT(seqno == cls_pkt_get_seq(pkt)); - odp_packet_free(pkt); - } -} - -#endif - void configure_pmr_cos(odp_bool_t enable_pktv) { uint16_t val; @@ -842,9 +722,6 @@ void configure_pmr_cos(odp_bool_t enable_pktv) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool_list[CLS_PMR]; cls_param.queue = queue_list[CLS_PMR]; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif if (enable_pktv) { cls_param.vector.enable = true; @@ -927,9 +804,6 @@ void configure_pktio_pmr_composite(odp_bool_t enable_pktv) odp_cls_cos_param_init(&cls_param); cls_param.pool = pool_list[CLS_PMR_SET]; cls_param.queue = queue_list[CLS_PMR_SET]; -#if ODP_DEPRECATED_API - cls_param.drop_policy = ODP_COS_DROP_POOL; -#endif if (enable_pktv) { cls_param.vector.enable = true; @@ -1029,13 +903,6 @@ static void cls_pktio_configure_common(odp_bool_t enable_pktv) tc.pmr_chain = 1; num_cos -= NUM_COS_PMR_CHAIN; } -#ifdef ODP_DEPRECATED - if (num_cos >= NUM_COS_L2_PRIO && TEST_L2_QOS) { - configure_cos_with_l2_priority(enable_pktv); - tc.l2_priority = 1; - num_cos -= NUM_COS_L2_PRIO; - } -#endif if (num_cos >= NUM_COS_PMR && TEST_PMR) { configure_pmr_cos(enable_pktv); tc.pmr_cos = 1; @@ -1070,10 +937,6 @@ static void cls_pktio_test_common(odp_bool_t enable_pktv) test_pktio_error_cos(enable_pktv); if (tc.pmr_chain && TEST_PMR_CHAIN) test_cls_pmr_chain(enable_pktv); -#ifdef ODP_DEPRECATED - if (tc.l2_priority && TEST_L2_QOS) - test_cos_with_l2_priority(enable_pktv); -#endif if (tc.pmr_cos && TEST_PMR) test_pmr_cos(enable_pktv); if (tc.pmr_composite_cos && TEST_PMR_SET) diff --git a/test/validation/api/classification/odp_classification_testsuites.h b/test/validation/api/classification/odp_classification_testsuites.h index 06e98d4cb..888613b1f 100644 --- a/test/validation/api/classification/odp_classification_testsuites.h +++ b/test/validation/api/classification/odp_classification_testsuites.h @@ -40,9 +40,6 @@ typedef union odp_cls_testcase { uint32_t drop_cos:1; uint32_t error_cos:1; uint32_t pmr_chain:1; -#ifdef ODP_DEPRECATED - uint32_t l2_priority:1; -#endif uint32_t pmr_cos:1; uint32_t pmr_composite_cos:1; }; |