@@ -87,8 +87,8 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len);
static void parse_args(int argc, char *argv[], appl_args_t *appl_args);
static void print_info(char *progname, appl_args_t *appl_args);
static void usage(char *progname);
-static void configure_cos(odp_pktio_t pktio, appl_args_t *args);
-static void configure_default_cos(odp_pktio_t pktio, appl_args_t *args);
+static void configure_cos(odp_cos_t default_cos, appl_args_t *args);
+static odp_cos_t configure_default_cos(odp_pktio_t pktio, appl_args_t *args);
static int convert_str_to_pmr_enum(char *token, odp_pmr_term_t *term,
uint32_t *offset);
static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg);
@@ -355,7 +355,7 @@ static void *pktio_receive_thread(void *arg)
return NULL;
}
-static void configure_default_cos(odp_pktio_t pktio, appl_args_t *args)
+static odp_cos_t configure_default_cos(odp_pktio_t pktio, appl_args_t *args)
{
odp_queue_param_t qparam;
const char *queue_name = "DefaultQueue";
@@ -417,9 +417,10 @@ static void configure_default_cos(odp_pktio_t pktio, appl_args_t *args)
odp_atomic_init_u64(&stats[args->policy_count].queue_pkt_count, 0);
odp_atomic_init_u64(&stats[args->policy_count].pool_pkt_count, 0);
args->policy_count++;
+ return cos_default;
}
-static void configure_cos(odp_pktio_t pktio, appl_args_t *args)
+static void configure_cos(odp_cos_t default_cos, appl_args_t *args)
{
char cos_name[ODP_COS_NAME_LEN];
char queue_name[ODP_QUEUE_NAME_LEN];
@@ -433,15 +434,6 @@ static void configure_cos(odp_pktio_t pktio, appl_args_t *args)
for (i = 0; i < args->policy_count; i++) {
stats = &args->stats[i];
- const odp_pmr_match_t match = {
- .term = stats->rule.term,
- .val = &stats->rule.val,
- .mask = &stats->rule.mask,
- .val_sz = stats->rule.val_sz,
- .offset = stats->rule.offset
- };
-
- stats->pmr = odp_pmr_create(&match);
odp_queue_param_init(&qparam);
qparam.type = ODP_QUEUE_TYPE_SCHED;
qparam.sched.prio = i % odp_schedule_num_prio();
@@ -480,7 +472,17 @@ static void configure_cos(odp_pktio_t pktio, appl_args_t *args)
cls_param.drop_policy = ODP_COS_DROP_POOL;
stats->cos = odp_cls_cos_create(cos_name, &cls_param);
- if (0 > odp_pktio_pmr_cos(stats->pmr, pktio, stats->cos)) {
+ const odp_pmr_match_t match = {
+ .term = stats->rule.term,
+ .val = &stats->rule.val,
+ .mask = &stats->rule.mask,
+ .val_sz = stats->rule.val_sz,
+ .offset = stats->rule.offset
+ };
+
+ stats->pmr = odp_cls_pmr_create(&match, 1, default_cos,
+ stats->cos);
+ if (stats->pmr == ODP_PMR_INVAL) {
EXAMPLE_ERR("odp_pktio_pmr_cos failed");
exit(EXIT_FAILURE);
}
@@ -505,6 +507,7 @@ int main(int argc, char *argv[])
odp_pool_param_t params;
odp_pktio_t pktio;
appl_args_t *args;
+ odp_cos_t default_cos;
odp_queue_t inq;
odp_shm_t shm;
@@ -576,10 +579,10 @@ int main(int argc, char *argv[])
/* create pktio per interface */
pktio = create_pktio(args->if_name, pool);
- configure_cos(pktio, args);
-
/* configure default Cos */
- configure_default_cos(pktio, args);
+ default_cos = configure_default_cos(pktio, args);
+
+ configure_cos(default_cos, args);
if (odp_pktio_start(pktio)) {
EXAMPLE_ERR("Error: unable to start pktio.\n");
@@ -606,6 +609,7 @@ int main(int argc, char *argv[])
print_cls_statistics(args);
for (i = 0; i < args->policy_count; i++) {
+ odp_cls_pmr_destroy(args->stats[i].pmr);
odp_cos_destroy(args->stats[i].cos);
odp_pool_destroy(args->stats[i].pool);
odp_queue_destroy(args->stats[i].queue);
@@ -62,8 +62,8 @@ void classification_test_create_pmr_match(void);
void classification_test_cos_set_queue(void);
void classification_test_cos_set_pool(void);
void classification_test_cos_set_drop(void);
-void classification_test_pmr_match_set_create(void);
-void classification_test_pmr_match_set_destroy(void);
+void classification_test_pmr_composite_create(void);
+void classification_test_pmr_composite_destroy(void);
void classification_test_pktio_set_skip(void);
void classification_test_pktio_set_headroom(void);
@@ -247,9 +247,9 @@ void classification_test_cos_set_drop(void)
odp_queue_destroy(queue);
}
-void classification_test_pmr_match_set_create(void)
+void classification_test_pmr_composite_create(void)
{
- odp_pmr_t pmr_set;
+ odp_pmr_t pmr_composite;
int retval;
odp_pmr_match_t pmr_terms[PMR_SET_NUM];
odp_cos_t default_cos;
@@ -295,12 +295,12 @@ void classification_test_pmr_match_set_create(void)
pmr_terms[i].val_sz = sizeof(val);
}
- pmr_set = odp_cls_pmr_create(pmr_terms, PMR_SET_NUM,
- default_cos, cos);
- CU_ASSERT(odp_pmr_to_u64(pmr_set) !=
+ pmr_composite = odp_cls_pmr_create(pmr_terms, PMR_SET_NUM,
+ default_cos, cos);
+ CU_ASSERT(odp_pmr_to_u64(pmr_composite) !=
odp_pmr_to_u64(ODP_PMR_INVAL));
- retval = odp_cls_pmr_destroy(pmr_set);
+ retval = odp_cls_pmr_destroy(pmr_composite);
CU_ASSERT(retval == 0);
odp_queue_destroy(queue);
@@ -320,6 +320,6 @@ odp_testinfo_t classification_suite_basic[] = {
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_composite_create),
ODP_TEST_INFO_NULL,
};
@@ -576,16 +576,16 @@ void configure_pktio_pmr_composite(void)
qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST;
qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL;
qparam.sched.group = ODP_SCHED_GROUP_ALL;
- sprintf(queuename, "%s", "cos_pmr_set_queue");
+ sprintf(queuename, "%s", "cos_pmr_composite_queue");
queue_list[CLS_PMR_SET] = odp_queue_create(queuename, &qparam);
CU_ASSERT_FATAL(queue_list[CLS_PMR_SET] != ODP_QUEUE_INVALID);
- sprintf(poolname, "cos_pmr_set_pool");
+ sprintf(poolname, "cos_pmr_composite_pool");
pool_list[CLS_PMR_SET] = pool_create(poolname);
CU_ASSERT_FATAL(pool_list[CLS_PMR_SET] != ODP_POOL_INVALID);
- sprintf(cosname, "cos_pmr_set");
+ sprintf(cosname, "cos_pmr_composite");
odp_cls_cos_param_init(&cls_param);
cls_param.pool = pool_list[CLS_PMR_SET];
cls_param.queue = queue_list[CLS_PMR_SET];
@@ -612,7 +612,7 @@ void configure_pktio_pmr_composite(void)
CU_ASSERT_FATAL(pmr_list[CLS_PMR_SET] != ODP_PMR_INVAL);
}
-void test_pktio_pmr_match_set_cos(void)
+void test_pktio_pmr_composite_cos(void)
{
uint32_t addr = 0;
uint32_t mask;
@@ -692,7 +692,7 @@ void classification_test_pktio_test(void)
if (TEST_PMR)
test_pmr_cos();
if (TEST_PMR_SET)
- test_pktio_pmr_match_set_cos();
+ test_pktio_pmr_composite_cos();
}
odp_testinfo_t classification_suite[] = {
@@ -47,7 +47,7 @@ void test_cos_with_l2_priority(void);
void configure_pmr_cos(void);
void test_pmr_cos(void);
void configure_pktio_pmr_composite(void);
-void test_pktio_pmr_match_set_cos(void);
+void test_pktio_pmr_composite_cos(void);
int destroy_inq(odp_pktio_t pktio);
odp_pmr_term_t find_first_supported_l3_pmr(void);
int set_first_supported_pmr_port(odp_packet_t pkt, uint16_t port);
Changes for packet match rule create function. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> --- example/classifier/odp_classifier.c | 38 ++++++++++++---------- test/validation/classification/classification.h | 4 +-- .../classification/odp_classification_basic.c | 14 ++++---- .../classification/odp_classification_tests.c | 10 +++--- .../classification/odp_classification_testsuites.h | 2 +- 5 files changed, 36 insertions(+), 32 deletions(-)