This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, master has been updated via 1a8b32c758894b0d0a71ebbd86efb77fd9eb334c (commit) via d3dd92949a71783f54530e06e5afa15ec9f507c2 (commit) via 61af8e3ac83e75e66a404edbbac9718ce99d95c0 (commit) via da423931fe6b6f4532bc05a71c7323bf28f7be2a (commit) via 5ae87b8706ae7d85a1c14a63359c737c6988abce (commit) from 5930362eaf96ea150987c4e4e69b17f09a8a8f3a (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 1a8b32c758894b0d0a71ebbd86efb77fd9eb334c Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon Nov 4 14:11:56 2019 +0200
example: cls: add support for UDP/TCP ports
Added support for UDP/TCP port PMR terms, and others with a 16 bit value.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 3af418704..f0cab8c05 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -37,7 +37,7 @@ /** @def MAX_PMR_COUNT * @brief Maximum number of Classification Policy */ -#define MAX_PMR_COUNT 8 +#define MAX_PMR_COUNT 32
/** @def DISPLAY_STRING_LEN * @brief Length of string used to display term value @@ -757,9 +757,27 @@ static int convert_str_to_pmr_enum(char *token, odp_cls_pmr_term_t *term) if (strcasecmp(token, "ODP_PMR_ETHTYPE_0") == 0) { *term = ODP_PMR_ETHTYPE_0; return 0; + } else if (strcasecmp(token, "ODP_PMR_ETHTYPE_X") == 0) { + *term = ODP_PMR_ETHTYPE_X; + return 0; } else if (strcasecmp(token, "ODP_PMR_VLAN_ID_0") == 0) { *term = ODP_PMR_VLAN_ID_0; return 0; + } else if (strcasecmp(token, "ODP_PMR_VLAN_ID_X") == 0) { + *term = ODP_PMR_VLAN_ID_X; + return 0; + } else if (strcasecmp(token, "ODP_PMR_UDP_DPORT") == 0) { + *term = ODP_PMR_UDP_DPORT; + return 0; + } else if (strcasecmp(token, "ODP_PMR_TCP_DPORT") == 0) { + *term = ODP_PMR_TCP_DPORT; + return 0; + } else if (strcasecmp(token, "ODP_PMR_UDP_SPORT") == 0) { + *term = ODP_PMR_UDP_SPORT; + return 0; + } else if (strcasecmp(token, "ODP_PMR_TCP_SPORT") == 0) { + *term = ODP_PMR_TCP_SPORT; + return 0; } else if (strcasecmp(token, "ODP_PMR_SIP_ADDR") == 0) { *term = ODP_PMR_SIP_ADDR; return 0; @@ -792,7 +810,8 @@ static int parse_pmr_policy(appl_args_t *appl_args, char *optarg)
/* last array index is needed for default queue */ if (policy_count >= MAX_PMR_COUNT - 1) { - ODPH_ERR("Maximum allowed PMR reached\n"); + ODPH_ERR("Too many policies. Max count is %i.\n", + MAX_PMR_COUNT - 1); return -1; }
@@ -814,10 +833,23 @@ static int parse_pmr_policy(appl_args_t *appl_args, char *optarg) /* PMR value */ switch (term) { case ODP_PMR_ETHTYPE_0: - /* :<type>:<mask> */ /* Fall through */ + case ODP_PMR_ETHTYPE_X: + /* Fall through */ + /* :<type>:<mask> */ case ODP_PMR_VLAN_ID_0: + /* Fall through */ + case ODP_PMR_VLAN_ID_X: + /* Fall through */ /* :<vlan_id>:<mask> */ + case ODP_PMR_UDP_DPORT: + /* Fall through */ + case ODP_PMR_TCP_DPORT: + /* Fall through */ + case ODP_PMR_UDP_SPORT: + /* Fall through */ + case ODP_PMR_TCP_SPORT: + /* :<port>:<mask> */ token = strtok(NULL, ":"); strncpy(stats[policy_count].value, token, DISPLAY_STRING_LEN - 1); @@ -951,7 +983,7 @@ static int parse_args(int argc, char *argv[], appl_args_t *appl_args) appl_args->cpu_count = 1; /* Use one worker by default */ appl_args->verbose = 0;
- while (1) { + while (ret == 0) { opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
@@ -963,8 +995,10 @@ static int parse_args(int argc, char *argv[], appl_args_t *appl_args) appl_args->cpu_count = atoi(optarg); break; case 'p': - if (0 > parse_pmr_policy(appl_args, optarg)) - continue; + if (parse_pmr_policy(appl_args, optarg)) { + ret = -1; + break; + } policy = 1; break; case 't':
commit d3dd92949a71783f54530e06e5afa15ec9f507c2 Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri Nov 1 14:14:45 2019 +0200
validation: cls: add parallel PMR test
Test serial and parallel PMR and CoS: - from default CoS to dest IPv4 CoS - from dest IPv4 CoS to a parallel UDP CoS per destination port number
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com
diff --git a/test/validation/api/classification/odp_classification_test_pmr.c b/test/validation/api/classification/odp_classification_test_pmr.c index 62f8a7425..7cbeca586 100644 --- a/test/validation/api/classification/odp_classification_test_pmr.c +++ b/test/validation/api/classification/odp_classification_test_pmr.c @@ -2367,6 +2367,11 @@ static void classification_test_pmr_serial(void) test_pmr_series(1); }
+static void classification_test_pmr_parallel(void) +{ + test_pmr_series(4); +} + static void classification_test_pmr_term_custom_frame(void) { test_pmr_term_custom(0); @@ -2511,6 +2516,8 @@ odp_testinfo_t classification_suite_pmr[] = { check_capa_custom_l3), ODP_TEST_INFO_CONDITIONAL(classification_test_pmr_serial, check_capa_pmr_series), + ODP_TEST_INFO_CONDITIONAL(classification_test_pmr_parallel, + check_capa_pmr_series), ODP_TEST_INFO(classification_test_pktin_classifier_flag), ODP_TEST_INFO(classification_test_pmr_term_tcp_dport_multi), ODP_TEST_INFO_NULL,
commit 61af8e3ac83e75e66a404edbbac9718ce99d95c0 Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri Nov 1 14:10:19 2019 +0200
validation: cls: add serial PMR test
Test series of PMR and CoS: - from default CoS to dest IPv4 CoS - from dest IPv4 CoS to dest UDP CoS
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com
diff --git a/test/validation/api/classification/odp_classification_test_pmr.c b/test/validation/api/classification/odp_classification_test_pmr.c index d4a3110e3..62f8a7425 100644 --- a/test/validation/api/classification/odp_classification_test_pmr.c +++ b/test/validation/api/classification/odp_classification_test_pmr.c @@ -2168,6 +2168,205 @@ static void test_pmr_term_custom(int custom_l3) odp_pktio_close(pktio); }
+/* + * Test a series of PMR rules and CoS. When num_udp is 1, test is serial + * from IP CoS to UDP CoS. When num_udp is larger than 1, a set of parallel + * UDP CoS are tested. + * + * dst IP dst UDP[0 ... 3] + * default_cos -> cos_ip -> cos_udp[0 ... 3] + */ +static void test_pmr_series(const int num_udp) +{ + odp_packet_t pkt; + uint32_t seqno; + int i, retval; + cls_packet_info_t pkt_info; + odp_pktio_t pktio; + odp_pool_t pool; + odp_queue_t default_queue; + odp_pool_t default_pool; + odp_cos_t default_cos; + odp_queue_t retqueue; + odp_pmr_t pmr_ip; + odp_queue_t queue_ip; + odp_cos_t cos_ip; + uint32_t dst_addr; + uint32_t dst_addr_be, ip_mask_be; + uint32_t dst_mask; + odp_pmr_param_t pmr_param; + odp_cls_cos_param_t cls_param; + odph_ethhdr_t *eth; + odph_ipv4hdr_t *ip; + odph_udphdr_t *udp; + odp_cos_t cos_udp[num_udp]; + odp_queue_t queue_udp[num_udp]; + odp_pmr_t pmr_udp[num_udp]; + uint16_t dst_port = 1000; + + pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true); + retval = start_pktio(pktio); + CU_ASSERT(retval == 0); + + configure_default_cos(pktio, &default_cos, + &default_queue, &default_pool); + + pool = pool_create("pmr_series"); + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + /* Dest IP address */ + queue_ip = queue_create("queue_ip", true); + CU_ASSERT_FATAL(queue_ip != ODP_QUEUE_INVALID); + + odp_cls_cos_param_init(&cls_param); + cls_param.pool = pool; + cls_param.queue = queue_ip; + cls_param.drop_policy = ODP_COS_DROP_POOL; + + cos_ip = odp_cls_cos_create("cos_ip", &cls_param); + CU_ASSERT_FATAL(cos_ip != ODP_COS_INVALID); + + parse_ipv4_string("10.0.9.99/32", &dst_addr, &dst_mask); + dst_addr_be = odp_cpu_to_be_32(dst_addr); + ip_mask_be = odp_cpu_to_be_32(dst_mask); + + odp_cls_pmr_param_init(&pmr_param); + pmr_param.term = ODP_PMR_DIP_ADDR; + pmr_param.match.value = &dst_addr_be; + pmr_param.match.mask = &ip_mask_be; + pmr_param.val_sz = sizeof(dst_addr_be); + pmr_param.offset = 0; + + pmr_ip = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos_ip); + CU_ASSERT_FATAL(pmr_ip != ODP_PMR_INVALID); + + /* Dest UDP port */ + for (i = 0; i < num_udp; i++) { + uint16_t dst_port_be = odp_cpu_to_be_16(dst_port + i); + uint16_t port_mask_be = odp_cpu_to_be_16(0xffff); + char name[] = "udp_0"; + + name[4] += i; + queue_udp[i] = queue_create(name, true); + CU_ASSERT_FATAL(queue_udp[i] != ODP_QUEUE_INVALID); + + odp_cls_cos_param_init(&cls_param); + cls_param.pool = pool; + cls_param.queue = queue_udp[i]; + cls_param.drop_policy = ODP_COS_DROP_POOL; + + cos_udp[i] = odp_cls_cos_create(name, &cls_param); + CU_ASSERT_FATAL(cos_udp[i] != ODP_COS_INVALID); + + odp_cls_pmr_param_init(&pmr_param); + pmr_param.term = ODP_PMR_UDP_DPORT; + pmr_param.match.value = &dst_port_be; + pmr_param.match.mask = &port_mask_be; + pmr_param.val_sz = 2; + pmr_param.offset = 0; + + pmr_udp[i] = odp_cls_pmr_create(&pmr_param, 1, + cos_ip, cos_udp[i]); + CU_ASSERT_FATAL(pmr_udp[i] != ODP_PMR_INVALID); + } + + /* Matching TCP/IP packet */ + pkt_info = default_pkt_info; + pkt_info.udp = false; + + pkt = create_packet(pkt_info); + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL); + + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); + ip->dst_addr = dst_addr_be; + + seqno = cls_pkt_get_seq(pkt); + CU_ASSERT(seqno != TEST_SEQ_INVALID); + + enqueue_pktio_interface(pkt, pktio); + + pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS); + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + CU_ASSERT(seqno == cls_pkt_get_seq(pkt)); + CU_ASSERT(retqueue == queue_ip); + odp_packet_free(pkt); + + /* Matching UDP/IP packets */ + pkt_info = default_pkt_info; + pkt_info.udp = true; + + for (i = 0; i < num_udp; i++) { + pkt = create_packet(pkt_info); + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL); + udp = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL); + + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); + ip->dst_addr = dst_addr_be; + udp->dst_port = odp_cpu_to_be_16(dst_port + i); + + seqno = cls_pkt_get_seq(pkt); + CU_ASSERT(seqno != TEST_SEQ_INVALID); + + enqueue_pktio_interface(pkt, pktio); + + pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS); + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + CU_ASSERT(seqno == cls_pkt_get_seq(pkt)); + CU_ASSERT(retqueue == queue_udp[i]); + odp_packet_free(pkt); + } + + /* Other packets delivered to default queue */ + pkt = create_packet(default_pkt_info); + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + seqno = cls_pkt_get_seq(pkt); + CU_ASSERT(seqno != TEST_SEQ_INVALID); + eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); + odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN); + + enqueue_pktio_interface(pkt, pktio); + + pkt = receive_packet(&retqueue, ODP_TIME_SEC_IN_NS); + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + CU_ASSERT(seqno == cls_pkt_get_seq(pkt)); + CU_ASSERT(retqueue == default_queue); + odp_packet_free(pkt); + + for (i = 0; i < num_udp; i++) { + odp_cos_destroy(cos_udp[i]); + odp_cls_pmr_destroy(pmr_udp[i]); + } + + odp_cos_destroy(cos_ip); + odp_cls_pmr_destroy(pmr_ip); + + odp_cos_destroy(default_cos); + stop_pktio(pktio); + odp_pool_destroy(default_pool); + odp_pool_destroy(pool); + + for (i = 0; i < num_udp; i++) + odp_queue_destroy(queue_udp[i]); + + odp_queue_destroy(queue_ip); + odp_queue_destroy(default_queue); + odp_pktio_close(pktio); +} + +static void classification_test_pmr_serial(void) +{ + test_pmr_series(1); +} + static void classification_test_pmr_term_custom_frame(void) { test_pmr_term_custom(0); @@ -2263,6 +2462,16 @@ static int check_capa_custom_l3(void) return cls_capa.supported_terms.bit.custom_l3; }
+static int check_capa_pmr_series(void) +{ + uint64_t support; + + support = cls_capa.supported_terms.bit.dip_addr && + cls_capa.supported_terms.bit.udp_dport; + + return support; +} + odp_testinfo_t classification_suite_pmr[] = { ODP_TEST_INFO_CONDITIONAL(classification_test_pmr_term_tcp_dport, check_capa_tcp_dport), @@ -2300,6 +2509,8 @@ odp_testinfo_t classification_suite_pmr[] = { check_capa_custom_frame), ODP_TEST_INFO_CONDITIONAL(classification_test_pmr_term_custom_l3, check_capa_custom_l3), + ODP_TEST_INFO_CONDITIONAL(classification_test_pmr_serial, + check_capa_pmr_series), ODP_TEST_INFO(classification_test_pktin_classifier_flag), ODP_TEST_INFO(classification_test_pmr_term_tcp_dport_multi), ODP_TEST_INFO_NULL,
commit da423931fe6b6f4532bc05a71c7323bf28f7be2a Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri Nov 1 16:17:01 2019 +0200
linux-gen: cls: fix PMR match recursion
Parallel PMR rules (leafs in classification tree) were not correctly checked.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com
diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index a803b52b2..23069b662 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -1275,10 +1275,10 @@ static int verify_pmr(pmr_t *pmr, const uint8_t *pkt_addr, }
if (pmr_failure) - return false; + return 0; } odp_atomic_inc_u32(&pmr->s.count); - return true; + return 1; }
/* @@ -1286,14 +1286,10 @@ static int verify_pmr(pmr_t *pmr, const uint8_t *pkt_addr, * This function gets called recursively to check the chained PMR Term value * with the packet. */ -static -cos_t *match_pmr_cos(cos_t *cos, const uint8_t *pkt_addr, pmr_t *pmr, - odp_packet_hdr_t *hdr) +static cos_t *match_pmr_cos(cos_t *cos, const uint8_t *pkt_addr, pmr_t *pmr, + odp_packet_hdr_t *hdr) { - cos_t *retcos; - uint32_t i; - - retcos = NULL; + uint32_t i, num_rule;
if (cos == NULL || pmr == NULL) return NULL; @@ -1302,19 +1298,29 @@ cos_t *match_pmr_cos(cos_t *cos, const uint8_t *pkt_addr, pmr_t *pmr, return NULL;
if (verify_pmr(pmr, pkt_addr, hdr)) { - /** This gets called recursively to check all the PMRs in - * a PMR chain */ - if (0 == odp_atomic_load_u32(&cos->s.num_rule)) + /* This gets called recursively. First matching leaf or branch + * is returned. */ + num_rule = odp_atomic_load_u32(&cos->s.num_rule); + + /* No more rules. This is the best match. */ + if (num_rule == 0) return cos;
- for (i = 0; i < odp_atomic_load_u32(&cos->s.num_rule); i++) { - retcos = match_pmr_cos(cos->s.linked_cos[i], pkt_addr, - cos->s.pmr[i], hdr); - if (!retcos) - return cos; + for (i = 0; i < num_rule; i++) { + cos_t *retcos = match_pmr_cos(cos->s.linked_cos[i], + pkt_addr, cos->s.pmr[i], + hdr); + + /* Found a matching leaf */ + if (retcos) + return retcos; } + + /* Current CoS was the best match */ + return cos; } - return retcos; + + return NULL; }
int pktio_classifier_init(pktio_entry_t *entry)
commit 5ae87b8706ae7d85a1c14a63359c737c6988abce Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri Nov 1 11:31:19 2019 +0200
linux-gen: cls: enable custom L3 protocols with CUSTOM_L3
Input flag for L3 is set only for known L3 protocols. Allow custom L3 protocols by checking L2 flag and L3 offset only.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com
diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index 1b5337ff6..a803b52b2 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -1087,7 +1087,8 @@ static inline int verify_pmr_custom_l3(const uint8_t *pkt_addr,
ODP_ASSERT(val_sz <= MAX_PMR_TERM_SIZE);
- if (!pkt_hdr->p.input_flags.l3) + if (pkt_hdr->p.input_flags.l2 == 0 || + l3_offset == ODP_PACKET_OFFSET_INVALID) return 0;
if (packet_len(pkt_hdr) <= offset + val_sz)
-----------------------------------------------------------------------
Summary of changes: example/classifier/odp_classifier.c | 46 ++++- platform/linux-generic/odp_classification.c | 45 +++-- .../classification/odp_classification_test_pmr.c | 218 +++++++++++++++++++++ 3 files changed, 284 insertions(+), 25 deletions(-)
hooks/post-receive