diff options
author | Luca Boccassi <luca.boccassi@gmail.com> | 2017-11-08 14:15:11 +0000 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2017-11-08 14:45:54 +0000 |
commit | 055c52583a2794da8ba1e85a48cce3832372b12f (patch) | |
tree | 8ceb1cb78fbb46a0f341f8ee24feb3c6b5540013 /test | |
parent | f239aed5e674965691846e8ce3f187dd47523689 (diff) |
New upstream version 17.11-rc3
Change-Id: I6a5baa40612fe0c20f30b5fa773a6cbbac63a685
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'test')
61 files changed, 5848 insertions, 6000 deletions
diff --git a/test/test-pipeline/config.c b/test/test-pipeline/config.c index eebb8102..741bd307 100644 --- a/test/test-pipeline/config.c +++ b/test/test-pipeline/config.c @@ -47,7 +47,6 @@ #include <rte_log.h> #include <rte_memory.h> #include <rte_memcpy.h> -#include <rte_memzone.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> diff --git a/test/test-pipeline/init.c b/test/test-pipeline/init.c index 1457c789..79536609 100644 --- a/test/test-pipeline/init.c +++ b/test/test-pipeline/init.c @@ -47,7 +47,6 @@ #include <rte_log.h> #include <rte_memory.h> #include <rte_memcpy.h> -#include <rte_memzone.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> @@ -194,9 +193,9 @@ app_ports_check_link(void) for (i = 0; i < app.n_ports; i++) { struct rte_eth_link link; - uint8_t port; + uint16_t port; - port = (uint8_t) app.ports[i]; + port = app.ports[i]; memset(&link, 0, sizeof(link)); rte_eth_link_get_nowait(port, &link); RTE_LOG(INFO, USER1, "Port %u (%u Gbps) %s\n", @@ -219,10 +218,10 @@ app_init_ports(void) /* Init NIC ports, then start the ports */ for (i = 0; i < app.n_ports; i++) { - uint8_t port; + uint16_t port; int ret; - port = (uint8_t) app.ports[i]; + port = app.ports[i]; RTE_LOG(INFO, USER1, "Initializing NIC port %u ...\n", port); /* Init port */ diff --git a/test/test-pipeline/main.c b/test/test-pipeline/main.c index 795b1aeb..a710173b 100644 --- a/test/test-pipeline/main.c +++ b/test/test-pipeline/main.c @@ -48,7 +48,6 @@ #include <rte_log.h> #include <rte_memory.h> #include <rte_memcpy.h> -#include <rte_memzone.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> diff --git a/test/test-pipeline/main.h b/test/test-pipeline/main.h index 36858492..26395a35 100644 --- a/test/test-pipeline/main.h +++ b/test/test-pipeline/main.h @@ -131,7 +131,10 @@ enum { void app_main_loop_rx(void); void app_main_loop_rx_metadata(void); -uint64_t test_hash(void *key, uint32_t key_size, uint64_t seed); +uint64_t test_hash(void *key, + void *key_mask, + uint32_t key_size, + uint64_t seed); void app_main_loop_worker(void); void app_main_loop_worker_pipeline_stub(void); diff --git a/test/test-pipeline/pipeline_hash.c b/test/test-pipeline/pipeline_hash.c index 991e381e..edc1663c 100644 --- a/test/test-pipeline/pipeline_hash.c +++ b/test/test-pipeline/pipeline_hash.c @@ -169,23 +169,23 @@ app_main_loop_worker_pipeline_hash(void) { "ring %d\n", i); } + struct rte_table_hash_params table_hash_params = { + .name = "TABLE", + .key_size = key_size, + .key_offset = APP_METADATA_OFFSET(32), + .key_mask = NULL, + .n_keys = 1 << 24, + .n_buckets = 1 << 22, + .f_hash = test_hash, + .seed = 0, + }; + /* Table configuration */ switch (app.pipeline_type) { case e_APP_PIPELINE_HASH_KEY8_EXT: case e_APP_PIPELINE_HASH_KEY16_EXT: case e_APP_PIPELINE_HASH_KEY32_EXT: { - struct rte_table_hash_ext_params table_hash_params = { - .key_size = key_size, - .n_keys = 1 << 24, - .n_buckets = 1 << 22, - .n_buckets_ext = 1 << 21, - .f_hash = test_hash, - .seed = 0, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), - }; - struct rte_pipeline_table_params table_params = { .ops = &rte_table_hash_ext_ops, .arg_create = &table_hash_params, @@ -204,16 +204,6 @@ app_main_loop_worker_pipeline_hash(void) { case e_APP_PIPELINE_HASH_KEY16_LRU: case e_APP_PIPELINE_HASH_KEY32_LRU: { - struct rte_table_hash_lru_params table_hash_params = { - .key_size = key_size, - .n_keys = 1 << 24, - .n_buckets = 1 << 22, - .f_hash = test_hash, - .seed = 0, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), - }; - struct rte_pipeline_table_params table_params = { .ops = &rte_table_hash_lru_ops, .arg_create = &table_hash_params, @@ -230,16 +220,6 @@ app_main_loop_worker_pipeline_hash(void) { case e_APP_PIPELINE_HASH_SPEC_KEY8_EXT: { - struct rte_table_hash_key8_ext_params table_hash_params = { - .n_entries = 1 << 24, - .n_entries_ext = 1 << 23, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), - .key_mask = NULL, - .f_hash = test_hash, - .seed = 0, - }; - struct rte_pipeline_table_params table_params = { .ops = &rte_table_hash_key8_ext_ops, .arg_create = &table_hash_params, @@ -256,15 +236,6 @@ app_main_loop_worker_pipeline_hash(void) { case e_APP_PIPELINE_HASH_SPEC_KEY8_LRU: { - struct rte_table_hash_key8_lru_params table_hash_params = { - .n_entries = 1 << 24, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), - .key_mask = NULL, - .f_hash = test_hash, - .seed = 0, - }; - struct rte_pipeline_table_params table_params = { .ops = &rte_table_hash_key8_lru_ops, .arg_create = &table_hash_params, @@ -281,16 +252,6 @@ app_main_loop_worker_pipeline_hash(void) { case e_APP_PIPELINE_HASH_SPEC_KEY16_EXT: { - struct rte_table_hash_key16_ext_params table_hash_params = { - .n_entries = 1 << 24, - .n_entries_ext = 1 << 23, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), - .f_hash = test_hash, - .seed = 0, - .key_mask = NULL, - }; - struct rte_pipeline_table_params table_params = { .ops = &rte_table_hash_key16_ext_ops, .arg_create = &table_hash_params, @@ -307,15 +268,6 @@ app_main_loop_worker_pipeline_hash(void) { case e_APP_PIPELINE_HASH_SPEC_KEY16_LRU: { - struct rte_table_hash_key16_lru_params table_hash_params = { - .n_entries = 1 << 24, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), - .f_hash = test_hash, - .seed = 0, - .key_mask = NULL, - }; - struct rte_pipeline_table_params table_params = { .ops = &rte_table_hash_key16_lru_ops, .arg_create = &table_hash_params, @@ -332,15 +284,6 @@ app_main_loop_worker_pipeline_hash(void) { case e_APP_PIPELINE_HASH_SPEC_KEY32_EXT: { - struct rte_table_hash_key32_ext_params table_hash_params = { - .n_entries = 1 << 24, - .n_entries_ext = 1 << 23, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), - .f_hash = test_hash, - .seed = 0, - }; - struct rte_pipeline_table_params table_params = { .ops = &rte_table_hash_key32_ext_ops, .arg_create = &table_hash_params, @@ -358,14 +301,6 @@ app_main_loop_worker_pipeline_hash(void) { case e_APP_PIPELINE_HASH_SPEC_KEY32_LRU: { - struct rte_table_hash_key32_lru_params table_hash_params = { - .n_entries = 1 << 24, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), - .f_hash = test_hash, - .seed = 0, - }; - struct rte_pipeline_table_params table_params = { .ops = &rte_table_hash_key32_lru_ops, .arg_create = &table_hash_params, @@ -390,23 +325,8 @@ app_main_loop_worker_pipeline_hash(void) { case e_APP_PIPELINE_HASH_CUCKOO_KEY112: case e_APP_PIPELINE_HASH_CUCKOO_KEY128: { - char hash_name[RTE_HASH_NAMESIZE]; - - snprintf(hash_name, sizeof(hash_name), "RTE_TH_CUCKOO_%d", - app.pipeline_type); - - struct rte_table_hash_cuckoo_params table_hash_params = { - .key_size = key_size, - .n_keys = (1 << 24) + 1, - .f_hash = test_hash, - .seed = 0, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), - .name = hash_name, - }; - struct rte_pipeline_table_params table_params = { - .ops = &rte_table_hash_cuckoo_dosig_ops, + .ops = &rte_table_hash_cuckoo_ops, .arg_create = &table_hash_params, .f_action_hit = NULL, .f_action_miss = NULL, @@ -477,6 +397,7 @@ app_main_loop_worker_pipeline_hash(void) { uint64_t test_hash( void *key, + __attribute__((unused)) void *key_mask, __attribute__((unused)) uint32_t key_size, __attribute__((unused)) uint64_t seed) { @@ -539,7 +460,7 @@ app_main_loop_rx_metadata(void) { } else continue; - *signature = test_hash(key, 0, 0); + *signature = test_hash(key, NULL, 0, 0); } do { diff --git a/test/test-pipeline/runtime.c b/test/test-pipeline/runtime.c index cb02fff0..c7c45379 100644 --- a/test/test-pipeline/runtime.c +++ b/test/test-pipeline/runtime.c @@ -47,7 +47,6 @@ #include <rte_log.h> #include <rte_memory.h> #include <rte_memcpy.h> -#include <rte_memzone.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> diff --git a/test/test/Makefile b/test/test/Makefile index 42d9a49e..bb54c980 100644 --- a/test/test/Makefile +++ b/test/test/Makefile @@ -94,6 +94,7 @@ SRCS-y += test_cycles.c SRCS-y += test_spinlock.c SRCS-y += test_memory.c SRCS-y += test_memzone.c +SRCS-y += test_bitmap.c SRCS-y += test_ring.c SRCS-y += test_ring_perf.c @@ -106,6 +107,7 @@ SRCS-y += test_table_tables.c SRCS-y += test_table_ports.c SRCS-y += test_table_combined.c SRCS-$(CONFIG_RTE_LIBRTE_ACL) += test_table_acl.c +SRCS-$(CONFIG_RTE_LIBRTE_FLOW_CLASSIFY) += test_flow_classify.c endif SRCS-y += test_rwlock.c @@ -123,6 +125,10 @@ SRCS-y += test_logs.c SRCS-y += test_memcpy.c SRCS-y += test_memcpy_perf.c + +SRCS-$(CONFIG_RTE_LIBRTE_MEMBER) += test_member.c +SRCS-$(CONFIG_RTE_LIBRTE_MEMBER) += test_member_perf.c + SRCS-$(CONFIG_RTE_LIBRTE_EFD) += test_efd.c SRCS-$(CONFIG_RTE_LIBRTE_EFD) += test_efd_perf.c @@ -198,12 +204,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c -SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y) SRCS-y += test_eventdev.c SRCS-y += test_event_ring.c +SRCS-y += test_event_eth_rx_adapter.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += test_eventdev_sw.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c endif diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index a93c3b59..8f4ddcc4 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -134,6 +134,36 @@ initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, return pkt_len; } +uint16_t +initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, + uint16_t dst_port, uint16_t pkt_data_len) +{ + uint16_t pkt_len; + + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct tcp_hdr)); + + memset(tcp_hdr, 0, sizeof(struct tcp_hdr)); + tcp_hdr->src_port = rte_cpu_to_be_16(src_port); + tcp_hdr->dst_port = rte_cpu_to_be_16(dst_port); + + return pkt_len; +} + +uint16_t +initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, + uint16_t dst_port, uint16_t pkt_data_len) +{ + uint16_t pkt_len; + + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + + sctp_hdr->src_port = rte_cpu_to_be_16(src_port); + sctp_hdr->dst_port = rte_cpu_to_be_16(dst_port); + sctp_hdr->tag = 0; + sctp_hdr->cksum = 0; /* No SCTP checksum. */ + + return pkt_len; +} uint16_t initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, @@ -198,7 +228,53 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, return pkt_len; } +uint16_t +initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, + uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto) +{ + uint16_t pkt_len; + unaligned_uint16_t *ptr16; + uint32_t ip_cksum; + + /* + * Initialize IP header. + */ + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct ipv4_hdr)); + + ip_hdr->version_ihl = IP_VHL_DEF; + ip_hdr->type_of_service = 0; + ip_hdr->fragment_offset = 0; + ip_hdr->time_to_live = IP_DEFTTL; + ip_hdr->next_proto_id = proto; + ip_hdr->packet_id = 0; + ip_hdr->total_length = rte_cpu_to_be_16(pkt_len); + ip_hdr->src_addr = rte_cpu_to_be_32(src_addr); + ip_hdr->dst_addr = rte_cpu_to_be_32(dst_addr); + + /* + * Compute IP header checksum. + */ + ptr16 = (unaligned_uint16_t *)ip_hdr; + ip_cksum = 0; + ip_cksum += ptr16[0]; ip_cksum += ptr16[1]; + ip_cksum += ptr16[2]; ip_cksum += ptr16[3]; + ip_cksum += ptr16[4]; + ip_cksum += ptr16[6]; ip_cksum += ptr16[7]; + ip_cksum += ptr16[8]; ip_cksum += ptr16[9]; + /* + * Reduce 32 bit checksum to 16 bits and complement it. + */ + ip_cksum = ((ip_cksum & 0xFFFF0000) >> 16) + + (ip_cksum & 0x0000FFFF); + ip_cksum %= 65536; + ip_cksum = (~ip_cksum) & 0x0000FFFF; + if (ip_cksum == 0) + ip_cksum = 0xFFFF; + ip_hdr->hdr_checksum = (uint16_t) ip_cksum; + + return pkt_len; +} /* * The maximum number of segments per packet is used when creating @@ -283,3 +359,118 @@ nomore_mbuf: return nb_pkt; } + +int +generate_packet_burst_proto(struct rte_mempool *mp, + struct rte_mbuf **pkts_burst, + struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + uint8_t ipv4, uint8_t proto, void *proto_hdr, + int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) +{ + int i, nb_pkt = 0; + size_t eth_hdr_size; + + struct rte_mbuf *pkt_seg; + struct rte_mbuf *pkt; + + for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { + pkt = rte_pktmbuf_alloc(mp); + if (pkt == NULL) { +nomore_mbuf: + if (nb_pkt == 0) + return -1; + break; + } + + pkt->data_len = pkt_len; + pkt_seg = pkt; + for (i = 1; i < nb_pkt_segs; i++) { + pkt_seg->next = rte_pktmbuf_alloc(mp); + if (pkt_seg->next == NULL) { + pkt->nb_segs = i; + rte_pktmbuf_free(pkt); + goto nomore_mbuf; + } + pkt_seg = pkt_seg->next; + pkt_seg->data_len = pkt_len; + } + pkt_seg->next = NULL; /* Last segment of packet. */ + + /* + * Copy headers in first packet segment(s). + */ + if (vlan_enabled) + eth_hdr_size = sizeof(struct ether_hdr) + + sizeof(struct vlan_hdr); + else + eth_hdr_size = sizeof(struct ether_hdr); + + copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); + + if (ipv4) { + copy_buf_to_pkt(ip_hdr, sizeof(struct ipv4_hdr), pkt, + eth_hdr_size); + switch (proto) { + case IPPROTO_UDP: + copy_buf_to_pkt(proto_hdr, + sizeof(struct udp_hdr), pkt, + eth_hdr_size + sizeof(struct ipv4_hdr)); + break; + case IPPROTO_TCP: + copy_buf_to_pkt(proto_hdr, + sizeof(struct tcp_hdr), pkt, + eth_hdr_size + sizeof(struct ipv4_hdr)); + break; + case IPPROTO_SCTP: + copy_buf_to_pkt(proto_hdr, + sizeof(struct sctp_hdr), pkt, + eth_hdr_size + sizeof(struct ipv4_hdr)); + break; + default: + break; + } + } else { + copy_buf_to_pkt(ip_hdr, sizeof(struct ipv6_hdr), pkt, + eth_hdr_size); + switch (proto) { + case IPPROTO_UDP: + copy_buf_to_pkt(proto_hdr, + sizeof(struct udp_hdr), pkt, + eth_hdr_size + sizeof(struct ipv6_hdr)); + break; + case IPPROTO_TCP: + copy_buf_to_pkt(proto_hdr, + sizeof(struct tcp_hdr), pkt, + eth_hdr_size + sizeof(struct ipv6_hdr)); + break; + case IPPROTO_SCTP: + copy_buf_to_pkt(proto_hdr, + sizeof(struct sctp_hdr), pkt, + eth_hdr_size + sizeof(struct ipv6_hdr)); + break; + default: + break; + } + } + + /* + * Complete first mbuf of packet and append it to the + * burst of packets to be transmitted. + */ + pkt->nb_segs = nb_pkt_segs; + pkt->pkt_len = pkt_len; + pkt->l2_len = eth_hdr_size; + + if (ipv4) { + pkt->vlan_tci = ETHER_TYPE_IPv4; + pkt->l3_len = sizeof(struct ipv4_hdr); + } else { + pkt->vlan_tci = ETHER_TYPE_IPv6; + pkt->l3_len = sizeof(struct ipv6_hdr); + } + + pkts_burst[nb_pkt] = pkt; + } + + return nb_pkt; +} diff --git a/test/test/packet_burst_generator.h b/test/test/packet_burst_generator.h index edc10441..3315bfa6 100644 --- a/test/test/packet_burst_generator.h +++ b/test/test/packet_burst_generator.h @@ -43,7 +43,8 @@ extern "C" { #include <rte_arp.h> #include <rte_ip.h> #include <rte_udp.h> - +#include <rte_tcp.h> +#include <rte_sctp.h> #define IPV4_ADDR(a, b, c, d)(((a & 0xff) << 24) | ((b & 0xff) << 16) | \ ((c & 0xff) << 8) | (d & 0xff)) @@ -65,6 +66,13 @@ uint16_t initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); +uint16_t +initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, + uint16_t dst_port, uint16_t pkt_data_len); + +uint16_t +initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, + uint16_t dst_port, uint16_t pkt_data_len); uint16_t initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, @@ -74,15 +82,25 @@ uint16_t initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len); +uint16_t +initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, + uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto); + int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); +int +generate_packet_burst_proto(struct rte_mempool *mp, + struct rte_mbuf **pkts_burst, + struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + uint8_t ipv4, uint8_t proto, void *proto_hdr, + int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); + #ifdef __cplusplus } #endif - #endif /* PACKET_BURST_GENERATOR_H_ */ diff --git a/test/test/process.h b/test/test/process.h index 4f8d1211..51ced122 100644 --- a/test/test/process.h +++ b/test/test/process.h @@ -52,11 +52,7 @@ static inline int process_dup(const char *const argv[], int numargs, const char *env_value) { int num; -#ifdef RTE_LIBRTE_XEN_DOM0 - char *argv_cpy[numargs + 2]; -#else char *argv_cpy[numargs + 1]; -#endif int i, fd, status; char path[32]; @@ -67,14 +63,8 @@ process_dup(const char *const argv[], int numargs, const char *env_value) /* make a copy of the arguments to be passed to exec */ for (i = 0; i < numargs; i++) argv_cpy[i] = strdup(argv[i]); -#ifdef RTE_LIBRTE_XEN_DOM0 - argv_cpy[i] = strdup("--xen-dom0"); - argv_cpy[i + 1] = NULL; - num = numargs + 1; -#else argv_cpy[i] = NULL; num = numargs; -#endif /* close all open file descriptors, check /proc/self/fd to only * call close on open fds. Exclude fds 0, 1 and 2*/ diff --git a/test/test/test.c b/test/test/test.c index c561eb56..0e6ff7ce 100644 --- a/test/test/test.c +++ b/test/test/test.c @@ -50,7 +50,6 @@ extern cmdline_parse_ctx_t main_ctx[]; #endif #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_eal.h> #include <rte_cycles.h> #include <rte_log.h> @@ -87,11 +86,7 @@ do_recursive_call(void) { "test_invalid_b_flag", no_action }, { "test_invalid_vdev_flag", no_action }, { "test_invalid_r_flag", no_action }, -#ifdef RTE_LIBRTE_XEN_DOM0 - { "test_dom0_misc_flags", no_action }, -#else { "test_misc_flags", no_action }, -#endif { "test_memory_flags", no_action }, { "test_file_prefix", no_action }, { "test_no_huge_flag", no_action }, diff --git a/test/test/test_atomic.c b/test/test/test_atomic.c index c68723ae..39c9a595 100644 --- a/test/test/test_atomic.c +++ b/test/test/test_atomic.c @@ -37,7 +37,6 @@ #include <sys/queue.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_per_lcore.h> #include <rte_launch.h> #include <rte_atomic.h> diff --git a/test/test/test_bitmap.c b/test/test/test_bitmap.c new file mode 100644 index 00000000..5c9eee96 --- /dev/null +++ b/test/test/test_bitmap.c @@ -0,0 +1,192 @@ +/* + * BSD LICENSE + * + * Copyright (C) Cavium, Inc. 2017. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Cavium, Inc nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <stdio.h> +#include <inttypes.h> + +#include <rte_common.h> +#include <rte_bitmap.h> +#include <rte_malloc.h> + +#include "test.h" + +#define MAX_BITS 1000 + +static int +test_bitmap_scan_operations(struct rte_bitmap *bmp) +{ + uint32_t pos = 0; + uint64_t slab1_magic = 0xBADC0FFEEBADF00D; + uint64_t slab2_magic = 0xFEEDDEADDEADF00D; + uint64_t out_slab = 0; + + rte_bitmap_reset(bmp); + + rte_bitmap_set_slab(bmp, pos, slab1_magic); + rte_bitmap_set_slab(bmp, pos + RTE_BITMAP_SLAB_BIT_SIZE, slab2_magic); + + if (!rte_bitmap_scan(bmp, &pos, &out_slab)) { + printf("Failed to get slab from bitmap.\n"); + return TEST_FAILED; + } + + if (slab1_magic != out_slab) { + printf("Scan operation sanity failed.\n"); + return TEST_FAILED; + } + + if (!rte_bitmap_scan(bmp, &pos, &out_slab)) { + printf("Failed to get slab from bitmap.\n"); + return TEST_FAILED; + } + + if (slab2_magic != out_slab) { + printf("Scan operation sanity failed.\n"); + return TEST_FAILED; + } + + /* Wrap around */ + if (!rte_bitmap_scan(bmp, &pos, &out_slab)) { + printf("Failed to get slab from bitmap.\n"); + return TEST_FAILED; + } + + if (slab1_magic != out_slab) { + printf("Scan operation wrap around failed.\n"); + return TEST_FAILED; + } + + /* Scan reset check. */ + __rte_bitmap_scan_init(bmp); + + if (!rte_bitmap_scan(bmp, &pos, &out_slab)) { + printf("Failed to get slab from bitmap.\n"); + return TEST_FAILED; + } + + if (slab1_magic != out_slab) { + printf("Scan reset operation failed.\n"); + return TEST_FAILED; + } + + return TEST_SUCCESS; +} + +static int +test_bitmap_slab_set_get(struct rte_bitmap *bmp) +{ + uint32_t pos = 0; + uint64_t slab_magic = 0xBADC0FFEEBADF00D; + uint64_t out_slab = 0; + + rte_bitmap_reset(bmp); + rte_bitmap_set_slab(bmp, pos, slab_magic); + + if (!rte_bitmap_scan(bmp, &pos, &out_slab)) { + printf("Failed to get slab from bitmap.\n"); + return TEST_FAILED; + } + + + if (slab_magic != out_slab) { + printf("Invalid slab in bitmap.\n"); + return TEST_FAILED; + } + + + return TEST_SUCCESS; +} + +static int +test_bitmap_set_get_clear(struct rte_bitmap *bmp) +{ + int i; + + rte_bitmap_reset(bmp); + for (i = 0; i < MAX_BITS; i++) + rte_bitmap_set(bmp, i); + + for (i = 0; i < MAX_BITS; i++) { + if (!rte_bitmap_get(bmp, i)) { + printf("Failed to get set bit.\n"); + return TEST_FAILED; + } + } + + for (i = 0; i < MAX_BITS; i++) + rte_bitmap_clear(bmp, i); + + for (i = 0; i < MAX_BITS; i++) { + if (rte_bitmap_get(bmp, i)) { + printf("Failed to clear set bit.\n"); + return TEST_FAILED; + } + } + + return TEST_SUCCESS; +} + +static int +test_bitmap(void) +{ + void *mem; + uint32_t bmp_size; + struct rte_bitmap *bmp; + + bmp_size = + rte_bitmap_get_memory_footprint(MAX_BITS); + + mem = rte_zmalloc("test_bmap", bmp_size, RTE_CACHE_LINE_SIZE); + if (mem == NULL) { + printf("Failed to allocate memory for bitmap\n"); + return TEST_FAILED; + } + + bmp = rte_bitmap_init(MAX_BITS, mem, bmp_size); + if (bmp == NULL) { + printf("Failed to init bitmap\n"); + return TEST_FAILED; + } + + if (test_bitmap_set_get_clear(bmp) < 0) + return TEST_FAILED; + + if (test_bitmap_slab_set_get(bmp) < 0) + return TEST_FAILED; + + if (test_bitmap_scan_operations(bmp) < 0) + return TEST_FAILED; + + return TEST_SUCCESS; +} + +REGISTER_TEST_COMMAND(bitmap_test, test_bitmap); diff --git a/test/test/test_cfgfile.c b/test/test/test_cfgfile.c index 4cc9b14d..37435b39 100644 --- a/test/test/test_cfgfile.c +++ b/test/test/test_cfgfile.c @@ -154,6 +154,43 @@ test_cfgfile_sample2(void) } static int +test_cfgfile_realloc_sections(void) +{ + struct rte_cfgfile *cfgfile; + int ret; + const char *value; + + cfgfile = rte_cfgfile_load(CFG_FILES_ETC "/realloc_sections.ini", 0); + TEST_ASSERT_NOT_NULL(cfgfile, "Failed to load config file"); + + ret = rte_cfgfile_num_sections(cfgfile, NULL, 0); + TEST_ASSERT(ret == 9, "Unexpected number of sections: %d", ret); + + ret = rte_cfgfile_has_section(cfgfile, "section9"); + TEST_ASSERT(ret, "section9 missing"); + + ret = rte_cfgfile_section_num_entries(cfgfile, "section3"); + TEST_ASSERT(ret == 21, + "section3 unexpected number of entries: %d", ret); + + ret = rte_cfgfile_section_num_entries(cfgfile, "section9"); + TEST_ASSERT(ret == 8, "section9 unexpected number of entries: %d", ret); + + value = rte_cfgfile_get_entry(cfgfile, "section9", "key8"); + TEST_ASSERT(strcmp("value8_section9", value) == 0, + "key unexpected value: %s", value); + + ret = rte_cfgfile_save(cfgfile, "/tmp/cfgfile_save.ini"); + TEST_ASSERT_SUCCESS(ret, "Failed to save *.ini file"); + remove("/tmp/cfgfile_save.ini"); + + ret = rte_cfgfile_close(cfgfile); + TEST_ASSERT_SUCCESS(ret, "Failed to close cfgfile"); + + return 0; +} + +static int test_cfgfile_invalid_section_header(void) { struct rte_cfgfile *cfgfile; @@ -292,6 +329,9 @@ test_cfgfile(void) if (test_cfgfile_sample2()) return -1; + if (test_cfgfile_realloc_sections()) + return -1; + if (test_cfgfile_invalid_section_header()) return -1; diff --git a/test/test/test_cfgfiles/etc/realloc_sections.ini b/test/test/test_cfgfiles/etc/realloc_sections.ini new file mode 100644 index 00000000..e653e40c --- /dev/null +++ b/test/test/test_cfgfiles/etc/realloc_sections.ini @@ -0,0 +1,128 @@ +[section1] +key1=value1_section1 +key2=value2_section1 +key3=value3_section1 +key4=value4_section1 +key5=value5_section1 +key6=value6_section1 +key7=value7_section1 +key8=value8_section1 +key9=value9_section1 +key10=value10_section1 +key11=value11_section1 +key12=value12_section1 +key13=value13_section1 +key14=value14_section1 +key15=value15_section1 +key16=value16_section1 +key17=value17_section1 +key18=value18_section1 +key19=value19_section1 +key20=value20_section1 +key21=value21_section1 + +[section2] +key1=value1_section2 +key2=value2_section2 +key3=value3_section2 +key4=value4_section2 +key5=value5_section2 +key6=value6_section2 +key7=value7_section2 +key8=value8_section2 +key9=value9_section2 +key10=value10_section2 +key11=value11_section2 +key12=value12_section2 +key13=value13_section2 +key14=value14_section2 +key15=value15_section2 +key16=value16_section2 +key17=value17_section2 +key18=value18_section2 +key19=value19_section2 +key20=value20_section2 +key21=value21_section2 + +[section3] +key1=value1_section3 +key2=value2_section3 +key3=value3_section3 +key4=value4_section3 +key5=value5_section3 +key6=value6_section3 +key7=value7_section3 +key8=value8_section3 +key9=value9_section3 +key10=value10_section3 +key11=value11_section3 +key12=value12_section3 +key13=value13_section3 +key14=value14_section3 +key15=value15_section3 +key16=value16_section3 +key17=value17_section3 +key18=value18_section3 +key19=value19_section3 +key20=value20_section3 +key21=value21_section3 + +[section4] +key1=value1_section4 +key2=value2_section4 +key3=value3_section4 +key4=value4_section4 +key5=value5_section4 +key6=value6_section4 +key7=value7_section4 +key8=value8_section4 + +[section5] +key1=value1_section5 +key2=value2_section5 +key3=value3_section5 +key4=value4_section5 +key5=value5_section5 +key6=value6_section5 +key7=value7_section5 +key8=value8_section5 + +[section6] +key1=value1_section6 +key2=value2_section6 +key3=value3_section6 +key4=value4_section6 +key5=value5_section6 +key6=value6_section6 +key7=value7_section6 +key8=value8_section6 + +[section7] +key1=value1_section7 +key2=value2_section7 +key3=value3_section7 +key4=value4_section7 +key5=value5_section7 +key6=value6_section7 +key7=value7_section7 +key8=value8_section7 + +[section8] +key1=value1_section8 +key2=value2_section8 +key3=value3_section8 +key4=value4_section8 +key5=value5_section8 +key6=value6_section8 +key7=value7_section8 +key8=value8_section8 + +[section9] +key1=value1_section9 +key2=value2_section9 +key3=value3_section9 +key4=value4_section9 +key5=value5_section9 +key6=value6_section9 +key7=value7_section9 +key8=value8_section9 diff --git a/test/test/test_cpuflags.c b/test/test/test_cpuflags.c index 0e5ebe78..08c16613 100644 --- a/test/test/test_cpuflags.c +++ b/test/test/test_cpuflags.c @@ -171,6 +171,9 @@ test_cpuflags(void) printf("Check for AVX2:\t\t"); CHECK_FOR_FLAG(RTE_CPUFLAG_AVX2); + printf("Check for AVX512F:\t"); + CHECK_FOR_FLAG(RTE_CPUFLAG_AVX512F); + printf("Check for TRBOBST:\t"); CHECK_FOR_FLAG(RTE_CPUFLAG_TRBOBST); diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c index a4116c65..1bed65da 100644 --- a/test/test/test_cryptodev.c +++ b/test/test/test_cryptodev.c @@ -36,6 +36,7 @@ #include <rte_malloc.h> #include <rte_memcpy.h> #include <rte_pause.h> +#include <rte_bus_vdev.h> #include <rte_crypto.h> #include <rte_cryptodev.h> @@ -58,7 +59,7 @@ #include "test_cryptodev_snow3g_test_vectors.h" #include "test_cryptodev_snow3g_hash_test_vectors.h" #include "test_cryptodev_zuc_test_vectors.h" -#include "test_cryptodev_gcm_test_vectors.h" +#include "test_cryptodev_aead_test_vectors.h" #include "test_cryptodev_hmac_test_vectors.h" static int gbl_driver_id; @@ -341,6 +342,28 @@ testsuite_setup(void) } } + /* Create a MRVL device if required */ + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_MRVL_PMD))) { +#ifndef RTE_LIBRTE_PMD_MRVL_CRYPTO + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_MRVL_CRYPTO must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif + nb_devs = rte_cryptodev_device_count_by_driver( + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_MRVL_PMD))); + if (nb_devs < 1) { + ret = rte_vdev_init( + RTE_STR(CRYPTODEV_NAME_MRVL_PMD), + NULL); + + TEST_ASSERT(ret == 0, "Failed to create " + "instance of pmd : %s", + RTE_STR(CRYPTODEV_NAME_MRVL_PMD)); + } + } + #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER if (gbl_driver_id == rte_cryptodev_driver_id_get( RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD))) { @@ -1310,7 +1333,7 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void) /* Set crypto operation authentication parameters */ sym_op->auth.digest.data = ut_params->digest; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, QUOTE_512_BYTES); sym_op->auth.data.offset = 0; @@ -1462,7 +1485,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess, sym_op->m_src = ut_params->ibuf; sym_op->auth.digest.data = ut_params->digest; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, QUOTE_512_BYTES); sym_op->auth.data.offset = 0; @@ -1768,6 +1791,63 @@ test_AES_cipheronly_qat_all(void) } static int +test_AES_chain_dpaa_sec_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)), + BLKCIPHER_AES_CHAIN_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_AES_cipheronly_dpaa_sec_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)), + BLKCIPHER_AES_CIPHERONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_authonly_dpaa_sec_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)), + BLKCIPHER_AUTHONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int test_AES_chain_dpaa2_sec_all(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -1816,7 +1896,7 @@ test_authonly_dpaa2_sec_all(void) ts_params->session_mpool, ts_params->valid_devs[0], rte_cryptodev_driver_id_get( - RTE_STR(RTE_CRYPTODEV_DPAA2_SEC_PMD)), + RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)), BLKCIPHER_AUTHONLY_TYPE); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1862,6 +1942,101 @@ test_AES_chain_armv8_all(void) return TEST_SUCCESS; } +static int +test_AES_chain_mrvl_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_MRVL_PMD)), + BLKCIPHER_AES_CHAIN_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_AES_cipheronly_mrvl_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_MRVL_PMD)), + BLKCIPHER_AES_CIPHERONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_authonly_mrvl_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_MRVL_PMD)), + BLKCIPHER_AUTHONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_3DES_chain_mrvl_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_MRVL_PMD)), + BLKCIPHER_3DES_CHAIN_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_3DES_cipheronly_mrvl_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_MRVL_PMD)), + BLKCIPHER_3DES_CIPHERONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + /* ***** SNOW 3G Tests ***** */ static int create_wireless_algo_hash_session(uint8_t dev_id, @@ -2211,7 +2386,7 @@ create_wireless_algo_hash_operation(const uint8_t *auth_tag, TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data, "no room to append auth tag"); ut_params->digest = sym_op->auth.digest.data; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, data_pad_len); if (op == RTE_CRYPTO_AUTH_OP_GENERATE) memset(sym_op->auth.digest.data, 0, auth_tag_len); @@ -2267,7 +2442,7 @@ create_wireless_cipher_hash_operation(const struct wireless_test_data *tdata, TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data, "no room to append auth tag"); ut_params->digest = sym_op->auth.digest.data; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, data_pad_len); if (op == RTE_CRYPTO_AUTH_OP_GENERATE) memset(sym_op->auth.digest.data, 0, auth_tag_len); @@ -2334,7 +2509,7 @@ create_wireless_algo_cipher_hash_operation(const uint8_t *auth_tag, TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data, "no room to append auth tag"); ut_params->digest = sym_op->auth.digest.data; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, data_pad_len); if (op == RTE_CRYPTO_AUTH_OP_GENERATE) memset(sym_op->auth.digest.data, 0, auth_tag_len); @@ -2392,7 +2567,7 @@ create_wireless_algo_auth_cipher_operation(unsigned int auth_tag_len, TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data, "no room to append auth tag"); - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, data_pad_len); memset(sym_op->auth.digest.data, 0, auth_tag_len); @@ -4672,6 +4847,25 @@ test_DES_cipheronly_qat_all(void) } static int +test_DES_cipheronly_openssl_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)), + BLKCIPHER_DES_CIPHERONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int test_DES_docsis_openssl_all(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -4691,6 +4885,82 @@ test_DES_docsis_openssl_all(void) } static int +test_DES_cipheronly_mb_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)), + BLKCIPHER_DES_CIPHERONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_DES_docsis_mb_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)), + BLKCIPHER_DES_DOCSIS_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_3DES_chain_dpaa_sec_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)), + BLKCIPHER_3DES_CHAIN_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_3DES_cipheronly_dpaa_sec_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)), + BLKCIPHER_3DES_CIPHERONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int test_3DES_chain_dpaa2_sec_all(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -4785,10 +5055,11 @@ test_3DES_cipheronly_openssl_all(void) return TEST_SUCCESS; } -/* ***** AES-GCM Tests ***** */ +/* ***** AEAD algorithm Tests ***** */ static int -create_gcm_session(uint8_t dev_id, enum rte_crypto_aead_operation op, +create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo, + enum rte_crypto_aead_operation op, const uint8_t *key, const uint8_t key_len, const uint16_t aad_len, const uint8_t auth_len, uint8_t iv_len) @@ -4803,7 +5074,7 @@ create_gcm_session(uint8_t dev_id, enum rte_crypto_aead_operation op, /* Setup AEAD Parameters */ ut_params->aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD; ut_params->aead_xform.next = NULL; - ut_params->aead_xform.aead.algo = RTE_CRYPTO_AEAD_AES_GCM; + ut_params->aead_xform.aead.algo = algo; ut_params->aead_xform.aead.op = op; ut_params->aead_xform.aead.key.data = aead_key; ut_params->aead_xform.aead.key.length = key_len; @@ -4827,7 +5098,8 @@ create_gcm_session(uint8_t dev_id, enum rte_crypto_aead_operation op, } static int -create_gcm_xforms(struct rte_crypto_op *op, +create_aead_xform(struct rte_crypto_op *op, + enum rte_crypto_aead_algorithm algo, enum rte_crypto_aead_operation aead_op, uint8_t *key, const uint8_t key_len, const uint8_t aad_len, const uint8_t auth_len, @@ -4841,7 +5113,7 @@ create_gcm_xforms(struct rte_crypto_op *op, /* Setup AEAD Parameters */ sym_op->xform->type = RTE_CRYPTO_SYM_XFORM_AEAD; sym_op->xform->next = NULL; - sym_op->xform->aead.algo = RTE_CRYPTO_AEAD_AES_GCM; + sym_op->xform->aead.algo = algo; sym_op->xform->aead.op = aead_op; sym_op->xform->aead.key.data = key; sym_op->xform->aead.key.length = key_len; @@ -4856,8 +5128,8 @@ create_gcm_xforms(struct rte_crypto_op *op, } static int -create_gcm_operation(enum rte_crypto_aead_operation op, - const struct gcm_test_data *tdata) +create_aead_operation(enum rte_crypto_aead_operation op, + const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -4874,25 +5146,49 @@ create_gcm_operation(enum rte_crypto_aead_operation op, struct rte_crypto_sym_op *sym_op = ut_params->op->sym; /* Append aad data */ - aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len, 16); - sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, - aad_pad_len); - TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data, - "no room to append aad"); - - sym_op->aead.aad.phys_addr = - rte_pktmbuf_mtophys(ut_params->ibuf); - memcpy(sym_op->aead.aad.data, tdata->aad.data, tdata->aad.len); - TEST_HEXDUMP(stdout, "aad:", sym_op->aead.aad.data, - tdata->aad.len); - - /* Append IV at the end of the crypto operation*/ - uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, - uint8_t *, IV_OFFSET); - - rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len); - TEST_HEXDUMP(stdout, "iv:", iv_ptr, - tdata->iv.len); + if (tdata->algo == RTE_CRYPTO_AEAD_AES_CCM) { + aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len + 18, 16); + sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, + aad_pad_len); + TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data, + "no room to append aad"); + + sym_op->aead.aad.phys_addr = + rte_pktmbuf_iova(ut_params->ibuf); + /* Copy AAD 18 bytes after the AAD pointer, according to the API */ + memcpy(sym_op->aead.aad.data + 18, tdata->aad.data, tdata->aad.len); + TEST_HEXDUMP(stdout, "aad:", sym_op->aead.aad.data, + tdata->aad.len); + + /* Append IV at the end of the crypto operation*/ + uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, + uint8_t *, IV_OFFSET); + + /* Copy IV 1 byte after the IV pointer, according to the API */ + rte_memcpy(iv_ptr + 1, tdata->iv.data, tdata->iv.len); + TEST_HEXDUMP(stdout, "iv:", iv_ptr, + tdata->iv.len); + } else { + aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len, 16); + sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, + aad_pad_len); + TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data, + "no room to append aad"); + + sym_op->aead.aad.phys_addr = + rte_pktmbuf_iova(ut_params->ibuf); + memcpy(sym_op->aead.aad.data, tdata->aad.data, tdata->aad.len); + TEST_HEXDUMP(stdout, "aad:", sym_op->aead.aad.data, + tdata->aad.len); + + /* Append IV at the end of the crypto operation*/ + uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, + uint8_t *, IV_OFFSET); + + rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len); + TEST_HEXDUMP(stdout, "iv:", iv_ptr, + tdata->iv.len); + } /* Append plaintext/ciphertext */ if (op == RTE_CRYPTO_AEAD_OP_ENCRYPT) { @@ -4948,7 +5244,7 @@ create_gcm_operation(enum rte_crypto_aead_operation op, TEST_ASSERT_NOT_NULL(sym_op->aead.digest.data, "no room to append digest"); memset(sym_op->aead.digest.data, 0, tdata->auth_tag.len); - sym_op->aead.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->aead.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->obuf ? ut_params->obuf : ut_params->ibuf, plaintext_pad_len + @@ -4958,7 +5254,7 @@ create_gcm_operation(enum rte_crypto_aead_operation op, ut_params->ibuf, tdata->auth_tag.len); TEST_ASSERT_NOT_NULL(sym_op->aead.digest.data, "no room to append digest"); - sym_op->aead.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->aead.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, plaintext_pad_len + aad_pad_len); @@ -4976,7 +5272,7 @@ create_gcm_operation(enum rte_crypto_aead_operation op, } static int -test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) +test_authenticated_encryption(const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -4986,8 +5282,9 @@ test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) uint16_t plaintext_pad_len; uint32_t i; - /* Create GCM session */ - retval = create_gcm_session(ts_params->valid_devs[0], + /* Create AEAD session */ + retval = create_aead_session(ts_params->valid_devs[0], + tdata->algo, RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata->key.data, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -4998,7 +5295,7 @@ test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) if (tdata->aad.len > MBUF_SIZE) { ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool); /* Populate full size of add data */ - for (i = 32; i < GCM_MAX_AAD_LENGTH; i += 32) + for (i = 32; i < MAX_AAD_LENGTH; i += 32) memcpy(&tdata->aad.data[i], &tdata->aad.data[0], 32); } else ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); @@ -5007,8 +5304,8 @@ test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->ibuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); if (retval < 0) return retval; @@ -5045,13 +5342,13 @@ test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) ciphertext, tdata->ciphertext.data, tdata->ciphertext.len, - "GCM Ciphertext data not as expected"); + "Ciphertext data not as expected"); TEST_ASSERT_BUFFERS_ARE_EQUAL( auth_tag, tdata->auth_tag.data, tdata->auth_tag.len, - "GCM Generated auth tag not as expected"); + "Generated auth tag not as expected"); return 0; @@ -5060,143 +5357,143 @@ test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) static int test_AES_GCM_authenticated_encryption_test_case_1(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_1); + return test_authenticated_encryption(&gcm_test_case_1); } static int test_AES_GCM_authenticated_encryption_test_case_2(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_2); + return test_authenticated_encryption(&gcm_test_case_2); } static int test_AES_GCM_authenticated_encryption_test_case_3(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_3); + return test_authenticated_encryption(&gcm_test_case_3); } static int test_AES_GCM_authenticated_encryption_test_case_4(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_4); + return test_authenticated_encryption(&gcm_test_case_4); } static int test_AES_GCM_authenticated_encryption_test_case_5(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_5); + return test_authenticated_encryption(&gcm_test_case_5); } static int test_AES_GCM_authenticated_encryption_test_case_6(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_6); + return test_authenticated_encryption(&gcm_test_case_6); } static int test_AES_GCM_authenticated_encryption_test_case_7(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_7); + return test_authenticated_encryption(&gcm_test_case_7); } static int test_AES_GCM_auth_encryption_test_case_192_1(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_1); + return test_authenticated_encryption(&gcm_test_case_192_1); } static int test_AES_GCM_auth_encryption_test_case_192_2(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_2); + return test_authenticated_encryption(&gcm_test_case_192_2); } static int test_AES_GCM_auth_encryption_test_case_192_3(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_3); + return test_authenticated_encryption(&gcm_test_case_192_3); } static int test_AES_GCM_auth_encryption_test_case_192_4(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_4); + return test_authenticated_encryption(&gcm_test_case_192_4); } static int test_AES_GCM_auth_encryption_test_case_192_5(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_5); + return test_authenticated_encryption(&gcm_test_case_192_5); } static int test_AES_GCM_auth_encryption_test_case_192_6(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_6); + return test_authenticated_encryption(&gcm_test_case_192_6); } static int test_AES_GCM_auth_encryption_test_case_192_7(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_7); + return test_authenticated_encryption(&gcm_test_case_192_7); } static int test_AES_GCM_auth_encryption_test_case_256_1(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_1); + return test_authenticated_encryption(&gcm_test_case_256_1); } static int test_AES_GCM_auth_encryption_test_case_256_2(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_2); + return test_authenticated_encryption(&gcm_test_case_256_2); } static int test_AES_GCM_auth_encryption_test_case_256_3(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_3); + return test_authenticated_encryption(&gcm_test_case_256_3); } static int test_AES_GCM_auth_encryption_test_case_256_4(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_4); + return test_authenticated_encryption(&gcm_test_case_256_4); } static int test_AES_GCM_auth_encryption_test_case_256_5(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_5); + return test_authenticated_encryption(&gcm_test_case_256_5); } static int test_AES_GCM_auth_encryption_test_case_256_6(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_6); + return test_authenticated_encryption(&gcm_test_case_256_6); } static int test_AES_GCM_auth_encryption_test_case_256_7(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_7); + return test_authenticated_encryption(&gcm_test_case_256_7); } static int test_AES_GCM_auth_encryption_test_case_aad_1(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_aad_1); + return test_authenticated_encryption(&gcm_test_case_aad_1); } static int test_AES_GCM_auth_encryption_test_case_aad_2(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_aad_2); + return test_authenticated_encryption(&gcm_test_case_aad_2); } static int -test_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) +test_authenticated_decryption(const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5205,8 +5502,9 @@ test_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) uint8_t *plaintext; uint32_t i; - /* Create GCM session */ - retval = create_gcm_session(ts_params->valid_devs[0], + /* Create AEAD session */ + retval = create_aead_session(ts_params->valid_devs[0], + tdata->algo, RTE_CRYPTO_AEAD_OP_DECRYPT, tdata->key.data, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -5218,7 +5516,7 @@ test_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) if (tdata->aad.len > MBUF_SIZE) { ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool); /* Populate full size of add data */ - for (i = 32; i < GCM_MAX_AAD_LENGTH; i += 32) + for (i = 32; i < MAX_AAD_LENGTH; i += 32) memcpy(&tdata->aad.data[i], &tdata->aad.data[0], 32); } else ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); @@ -5226,8 +5524,8 @@ test_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->ibuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); if (retval < 0) return retval; @@ -5257,154 +5555,154 @@ test_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) plaintext, tdata->plaintext.data, tdata->plaintext.len, - "GCM plaintext data not as expected"); + "Plaintext data not as expected"); TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "GCM authentication failed"); + "Authentication failed"); return 0; } static int test_AES_GCM_authenticated_decryption_test_case_1(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_1); + return test_authenticated_decryption(&gcm_test_case_1); } static int test_AES_GCM_authenticated_decryption_test_case_2(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_2); + return test_authenticated_decryption(&gcm_test_case_2); } static int test_AES_GCM_authenticated_decryption_test_case_3(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_3); + return test_authenticated_decryption(&gcm_test_case_3); } static int test_AES_GCM_authenticated_decryption_test_case_4(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_4); + return test_authenticated_decryption(&gcm_test_case_4); } static int test_AES_GCM_authenticated_decryption_test_case_5(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_5); + return test_authenticated_decryption(&gcm_test_case_5); } static int test_AES_GCM_authenticated_decryption_test_case_6(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_6); + return test_authenticated_decryption(&gcm_test_case_6); } static int test_AES_GCM_authenticated_decryption_test_case_7(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_7); + return test_authenticated_decryption(&gcm_test_case_7); } static int test_AES_GCM_auth_decryption_test_case_192_1(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_1); + return test_authenticated_decryption(&gcm_test_case_192_1); } static int test_AES_GCM_auth_decryption_test_case_192_2(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_2); + return test_authenticated_decryption(&gcm_test_case_192_2); } static int test_AES_GCM_auth_decryption_test_case_192_3(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_3); + return test_authenticated_decryption(&gcm_test_case_192_3); } static int test_AES_GCM_auth_decryption_test_case_192_4(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_4); + return test_authenticated_decryption(&gcm_test_case_192_4); } static int test_AES_GCM_auth_decryption_test_case_192_5(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_5); + return test_authenticated_decryption(&gcm_test_case_192_5); } static int test_AES_GCM_auth_decryption_test_case_192_6(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_6); + return test_authenticated_decryption(&gcm_test_case_192_6); } static int test_AES_GCM_auth_decryption_test_case_192_7(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_7); + return test_authenticated_decryption(&gcm_test_case_192_7); } static int test_AES_GCM_auth_decryption_test_case_256_1(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_1); + return test_authenticated_decryption(&gcm_test_case_256_1); } static int test_AES_GCM_auth_decryption_test_case_256_2(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_2); + return test_authenticated_decryption(&gcm_test_case_256_2); } static int test_AES_GCM_auth_decryption_test_case_256_3(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_3); + return test_authenticated_decryption(&gcm_test_case_256_3); } static int test_AES_GCM_auth_decryption_test_case_256_4(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_4); + return test_authenticated_decryption(&gcm_test_case_256_4); } static int test_AES_GCM_auth_decryption_test_case_256_5(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_5); + return test_authenticated_decryption(&gcm_test_case_256_5); } static int test_AES_GCM_auth_decryption_test_case_256_6(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_6); + return test_authenticated_decryption(&gcm_test_case_256_6); } static int test_AES_GCM_auth_decryption_test_case_256_7(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_7); + return test_authenticated_decryption(&gcm_test_case_256_7); } static int test_AES_GCM_auth_decryption_test_case_aad_1(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_aad_1); + return test_authenticated_decryption(&gcm_test_case_aad_1); } static int test_AES_GCM_auth_decryption_test_case_aad_2(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_aad_2); + return test_authenticated_decryption(&gcm_test_case_aad_2); } static int -test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata) +test_authenticated_encryption_oop(const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5413,8 +5711,9 @@ test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata) uint8_t *ciphertext, *auth_tag; uint16_t plaintext_pad_len; - /* Create GCM session */ - retval = create_gcm_session(ts_params->valid_devs[0], + /* Create AEAD session */ + retval = create_aead_session(ts_params->valid_devs[0], + tdata->algo, RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata->key.data, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -5431,8 +5730,8 @@ test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata) memset(rte_pktmbuf_mtod(ut_params->obuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->obuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); if (retval < 0) return retval; @@ -5462,13 +5761,13 @@ test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata) ciphertext, tdata->ciphertext.data, tdata->ciphertext.len, - "GCM Ciphertext data not as expected"); + "Ciphertext data not as expected"); TEST_ASSERT_BUFFERS_ARE_EQUAL( auth_tag, tdata->auth_tag.data, tdata->auth_tag.len, - "GCM Generated auth tag not as expected"); + "Generated auth tag not as expected"); return 0; @@ -5477,11 +5776,11 @@ test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata) static int test_AES_GCM_authenticated_encryption_oop_test_case_1(void) { - return test_AES_GCM_authenticated_encryption_oop(&gcm_test_case_5); + return test_authenticated_encryption_oop(&gcm_test_case_5); } static int -test_AES_GCM_authenticated_decryption_oop(const struct gcm_test_data *tdata) +test_authenticated_decryption_oop(const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5489,8 +5788,9 @@ test_AES_GCM_authenticated_decryption_oop(const struct gcm_test_data *tdata) int retval; uint8_t *plaintext; - /* Create GCM session */ - retval = create_gcm_session(ts_params->valid_devs[0], + /* Create AEAD session */ + retval = create_aead_session(ts_params->valid_devs[0], + tdata->algo, RTE_CRYPTO_AEAD_OP_DECRYPT, tdata->key.data, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -5507,8 +5807,8 @@ test_AES_GCM_authenticated_decryption_oop(const struct gcm_test_data *tdata) memset(rte_pktmbuf_mtod(ut_params->obuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->obuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); if (retval < 0) return retval; @@ -5534,23 +5834,23 @@ test_AES_GCM_authenticated_decryption_oop(const struct gcm_test_data *tdata) plaintext, tdata->plaintext.data, tdata->plaintext.len, - "GCM plaintext data not as expected"); + "Plaintext data not as expected"); TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "GCM authentication failed"); + "Authentication failed"); return 0; } static int test_AES_GCM_authenticated_decryption_oop_test_case_1(void) { - return test_AES_GCM_authenticated_decryption_oop(&gcm_test_case_5); + return test_authenticated_decryption_oop(&gcm_test_case_5); } static int -test_AES_GCM_authenticated_encryption_sessionless( - const struct gcm_test_data *tdata) +test_authenticated_encryption_sessionless( + const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5566,14 +5866,15 @@ test_AES_GCM_authenticated_encryption_sessionless( memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->ibuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); if (retval < 0) return retval; - /* Create GCM xforms */ + /* Create GCM xform */ memcpy(key, tdata->key.data, tdata->key.len); - retval = create_gcm_xforms(ut_params->op, + retval = create_aead_xform(ut_params->op, + tdata->algo, RTE_CRYPTO_AEAD_OP_ENCRYPT, key, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -5610,13 +5911,13 @@ test_AES_GCM_authenticated_encryption_sessionless( ciphertext, tdata->ciphertext.data, tdata->ciphertext.len, - "GCM Ciphertext data not as expected"); + "Ciphertext data not as expected"); TEST_ASSERT_BUFFERS_ARE_EQUAL( auth_tag, tdata->auth_tag.data, tdata->auth_tag.len, - "GCM Generated auth tag not as expected"); + "Generated auth tag not as expected"); return 0; @@ -5625,13 +5926,13 @@ test_AES_GCM_authenticated_encryption_sessionless( static int test_AES_GCM_authenticated_encryption_sessionless_test_case_1(void) { - return test_AES_GCM_authenticated_encryption_sessionless( + return test_authenticated_encryption_sessionless( &gcm_test_case_5); } static int -test_AES_GCM_authenticated_decryption_sessionless( - const struct gcm_test_data *tdata) +test_authenticated_decryption_sessionless( + const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5646,14 +5947,15 @@ test_AES_GCM_authenticated_decryption_sessionless( memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->ibuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); if (retval < 0) return retval; - /* Create GCM xforms */ + /* Create AEAD xform */ memcpy(key, tdata->key.data, tdata->key.len); - retval = create_gcm_xforms(ut_params->op, + retval = create_aead_xform(ut_params->op, + tdata->algo, RTE_CRYPTO_AEAD_OP_DECRYPT, key, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -5686,22 +5988,130 @@ test_AES_GCM_authenticated_decryption_sessionless( plaintext, tdata->plaintext.data, tdata->plaintext.len, - "GCM plaintext data not as expected"); + "Plaintext data not as expected"); TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "GCM authentication failed"); + "Authentication failed"); return 0; } static int test_AES_GCM_authenticated_decryption_sessionless_test_case_1(void) { - return test_AES_GCM_authenticated_decryption_sessionless( + return test_authenticated_decryption_sessionless( &gcm_test_case_5); } static int +test_AES_CCM_authenticated_encryption_test_case_128_1(void) +{ + return test_authenticated_encryption(&ccm_test_case_128_1); +} + +static int +test_AES_CCM_authenticated_encryption_test_case_128_2(void) +{ + return test_authenticated_encryption(&ccm_test_case_128_2); +} + +static int +test_AES_CCM_authenticated_encryption_test_case_128_3(void) +{ + return test_authenticated_encryption(&ccm_test_case_128_3); +} + +static int +test_AES_CCM_authenticated_decryption_test_case_128_1(void) +{ + return test_authenticated_decryption(&ccm_test_case_128_1); +} + +static int +test_AES_CCM_authenticated_decryption_test_case_128_2(void) +{ + return test_authenticated_decryption(&ccm_test_case_128_2); +} + +static int +test_AES_CCM_authenticated_decryption_test_case_128_3(void) +{ + return test_authenticated_decryption(&ccm_test_case_128_3); +} + +static int +test_AES_CCM_authenticated_encryption_test_case_192_1(void) +{ + return test_authenticated_encryption(&ccm_test_case_192_1); +} + +static int +test_AES_CCM_authenticated_encryption_test_case_192_2(void) +{ + return test_authenticated_encryption(&ccm_test_case_192_2); +} + +static int +test_AES_CCM_authenticated_encryption_test_case_192_3(void) +{ + return test_authenticated_encryption(&ccm_test_case_192_3); +} + +static int +test_AES_CCM_authenticated_decryption_test_case_192_1(void) +{ + return test_authenticated_decryption(&ccm_test_case_192_1); +} + +static int +test_AES_CCM_authenticated_decryption_test_case_192_2(void) +{ + return test_authenticated_decryption(&ccm_test_case_192_2); +} + +static int +test_AES_CCM_authenticated_decryption_test_case_192_3(void) +{ + return test_authenticated_decryption(&ccm_test_case_192_3); +} + +static int +test_AES_CCM_authenticated_encryption_test_case_256_1(void) +{ + return test_authenticated_encryption(&ccm_test_case_256_1); +} + +static int +test_AES_CCM_authenticated_encryption_test_case_256_2(void) +{ + return test_authenticated_encryption(&ccm_test_case_256_2); +} + +static int +test_AES_CCM_authenticated_encryption_test_case_256_3(void) +{ + return test_authenticated_encryption(&ccm_test_case_256_3); +} + +static int +test_AES_CCM_authenticated_decryption_test_case_256_1(void) +{ + return test_authenticated_decryption(&ccm_test_case_256_1); +} + +static int +test_AES_CCM_authenticated_decryption_test_case_256_2(void) +{ + return test_authenticated_decryption(&ccm_test_case_256_2); +} + +static int +test_AES_CCM_authenticated_decryption_test_case_256_3(void) +{ + return test_authenticated_decryption(&ccm_test_case_256_3); +} + +static int test_stats(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -5817,7 +6227,7 @@ static int MD5_HMAC_create_op(struct crypto_unittest_params *ut_params, ut_params->ibuf, MD5_DIGEST_LEN); TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data, "no room to append digest"); - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, plaintext_pad_len); if (ut_params->auth_xform.auth.op == RTE_CRYPTO_AUTH_OP_VERIFY) { @@ -6553,7 +6963,7 @@ create_gmac_operation(enum rte_crypto_auth_operation op, TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data, "no room to append digest"); - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, plaintext_pad_len); if (op == RTE_CRYPTO_AUTH_OP_VERIFY) { @@ -7075,7 +7485,7 @@ create_auth_operation(struct crypto_testsuite_params *ts_params, TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data, "no room to append auth tag"); - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, reference->plaintext.len); if (auth_generate) @@ -7122,7 +7532,7 @@ create_auth_GMAC_operation(struct crypto_testsuite_params *ts_params, TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data, "no room to append auth tag"); - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, reference->ciphertext.len); if (auth_generate) @@ -7175,7 +7585,7 @@ create_cipher_auth_operation(struct crypto_testsuite_params *ts_params, TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data, "no room to append auth tag"); - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset( ut_params->ibuf, reference->ciphertext.len); if (auth_generate) @@ -7406,8 +7816,8 @@ test_authenticated_decryption_fail_when_corruption( } static int -create_gcm_operation_SGL(enum rte_crypto_aead_operation op, - const struct gcm_test_data *tdata, +create_aead_operation_SGL(enum rte_crypto_aead_operation op, + const struct aead_test_data *tdata, void *digest_mem, uint64_t digest_phys) { struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -7415,7 +7825,7 @@ create_gcm_operation_SGL(enum rte_crypto_aead_operation op, const unsigned int auth_tag_len = tdata->auth_tag.len; const unsigned int iv_len = tdata->iv.len; - const unsigned int aad_len = tdata->aad.len; + unsigned int aad_len = tdata->aad.len; /* Generate Crypto op data structure */ ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, @@ -7440,24 +7850,50 @@ create_gcm_operation_SGL(enum rte_crypto_aead_operation op, auth_tag_len); } - uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, - uint8_t *, IV_OFFSET); + /* Append aad data */ + if (tdata->algo == RTE_CRYPTO_AEAD_AES_CCM) { + uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, + uint8_t *, IV_OFFSET); - rte_memcpy(iv_ptr, tdata->iv.data, iv_len); + /* Copy IV 1 byte after the IV pointer, according to the API */ + rte_memcpy(iv_ptr + 1, tdata->iv.data, iv_len); - sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_prepend( - ut_params->ibuf, aad_len); - TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data, - "no room to prepend aad"); - sym_op->aead.aad.phys_addr = rte_pktmbuf_mtophys( - ut_params->ibuf); + aad_len = RTE_ALIGN_CEIL(aad_len + 18, 16); - memset(sym_op->aead.aad.data, 0, aad_len); - rte_memcpy(sym_op->aead.aad.data, tdata->aad.data, aad_len); + sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_prepend( + ut_params->ibuf, aad_len); + TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data, + "no room to prepend aad"); + sym_op->aead.aad.phys_addr = rte_pktmbuf_iova( + ut_params->ibuf); - TEST_HEXDUMP(stdout, "iv:", iv_ptr, iv_len); - TEST_HEXDUMP(stdout, "aad:", - sym_op->aead.aad.data, aad_len); + memset(sym_op->aead.aad.data, 0, aad_len); + /* Copy AAD 18 bytes after the AAD pointer, according to the API */ + rte_memcpy(sym_op->aead.aad.data, tdata->aad.data, aad_len); + + TEST_HEXDUMP(stdout, "iv:", iv_ptr, iv_len); + TEST_HEXDUMP(stdout, "aad:", + sym_op->aead.aad.data, aad_len); + } else { + uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, + uint8_t *, IV_OFFSET); + + rte_memcpy(iv_ptr, tdata->iv.data, iv_len); + + sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_prepend( + ut_params->ibuf, aad_len); + TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data, + "no room to prepend aad"); + sym_op->aead.aad.phys_addr = rte_pktmbuf_iova( + ut_params->ibuf); + + memset(sym_op->aead.aad.data, 0, aad_len); + rte_memcpy(sym_op->aead.aad.data, tdata->aad.data, aad_len); + + TEST_HEXDUMP(stdout, "iv:", iv_ptr, iv_len); + TEST_HEXDUMP(stdout, "aad:", + sym_op->aead.aad.data, aad_len); + } sym_op->aead.data.length = tdata->plaintext.len; sym_op->aead.data.offset = aad_len; @@ -7468,7 +7904,7 @@ create_gcm_operation_SGL(enum rte_crypto_aead_operation op, #define SGL_MAX_NO 16 static int -test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, +test_authenticated_encryption_SGL(const struct aead_test_data *tdata, const int oop, uint32_t fragsz, uint32_t fragsz_oop) { struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -7513,8 +7949,9 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, buf_oop = ut_params->obuf; } - /* Create GCM session */ - retval = create_gcm_session(ts_params->valid_devs[0], + /* Create AEAD session */ + retval = create_aead_session(ts_params->valid_devs[0], + tdata->algo, RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata->key.data, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -7594,7 +8031,7 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, digest_mem = rte_pktmbuf_append(ut_params->obuf, tdata->auth_tag.len); - digest_phys = rte_pktmbuf_mtophys_offset( + digest_phys = rte_pktmbuf_iova_offset( ut_params->obuf, tdata->plaintext.len + prepend_len); } @@ -7632,19 +8069,19 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, * Place digest at the end of the last buffer */ if (!digest_phys) - digest_phys = rte_pktmbuf_mtophys(buf) + to_trn; + digest_phys = rte_pktmbuf_iova(buf) + to_trn; if (oop && buf_last_oop) - digest_phys = rte_pktmbuf_mtophys(buf_last_oop) + to_trn; + digest_phys = rte_pktmbuf_iova(buf_last_oop) + to_trn; if (!digest_mem && !oop) { digest_mem = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, + tdata->auth_tag.len); - digest_phys = rte_pktmbuf_mtophys_offset(ut_params->ibuf, + digest_phys = rte_pktmbuf_iova_offset(ut_params->ibuf, tdata->plaintext.len); } - /* Create GCM opertaion */ - retval = create_gcm_operation_SGL(RTE_CRYPTO_AEAD_OP_ENCRYPT, + /* Create AEAD operation */ + retval = create_aead_operation_SGL(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata, digest_mem, digest_phys); if (retval < 0) @@ -7678,7 +8115,7 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, ciphertext, tdata->ciphertext.data, fragsz, - "GCM Ciphertext data not as expected"); + "Ciphertext data not as expected"); buf = ut_params->op->sym->m_src->next; if (oop) @@ -7695,7 +8132,7 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, ciphertext, tdata->ciphertext.data + off, to_trn_tbl[ecx], - "GCM Ciphertext data not as expected"); + "Ciphertext data not as expected"); off += to_trn_tbl[ecx++]; buf = buf->next; @@ -7706,7 +8143,7 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, auth_tag, tdata->auth_tag.data, tdata->auth_tag.len, - "GCM Generated auth tag not as expected"); + "Generated auth tag not as expected"); return 0; } @@ -7717,21 +8154,21 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, static int test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_400B(void) { - return test_AES_GCM_authenticated_encryption_SGL( + return test_authenticated_encryption_SGL( &gcm_test_case_SGL_1, OUT_OF_PLACE, 400, 400); } static int test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B(void) { - return test_AES_GCM_authenticated_encryption_SGL( + return test_authenticated_encryption_SGL( &gcm_test_case_SGL_1, OUT_OF_PLACE, 1500, 2000); } static int test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg(void) { - return test_AES_GCM_authenticated_encryption_SGL( + return test_authenticated_encryption_SGL( &gcm_test_case_8, OUT_OF_PLACE, 400, gcm_test_case_8.plaintext.len); } @@ -7740,7 +8177,7 @@ static int test_AES_GCM_auth_encrypt_SGL_in_place_1500B(void) { - return test_AES_GCM_authenticated_encryption_SGL( + return test_authenticated_encryption_SGL( &gcm_test_case_SGL_1, IN_PLACE, 1500, 0); } @@ -8037,6 +8474,22 @@ static struct unit_test_suite cryptodev_qat_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_qat_all), TEST_CASE_ST(ut_setup, ut_teardown, test_stats), + /** AES CCM Authenticated Encryption 128 bits key */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_128_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_128_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_128_3), + + /** AES CCM Authenticated Decryption 128 bits key*/ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_128_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_128_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_128_3), + /** AES GCM Authenticated Encryption */ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GCM_auth_encrypt_SGL_in_place_1500B), @@ -8289,6 +8742,10 @@ static struct unit_test_suite cryptodev_aesni_mb_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_mb_all), TEST_CASE_ST(ut_setup, ut_teardown, test_AES_docsis_mb_all), TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_mb_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_DES_cipheronly_mb_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_DES_docsis_mb_all), TEST_CASES_END() /**< NULL terminate unit test array */ } @@ -8311,6 +8768,8 @@ static struct unit_test_suite cryptodev_openssl_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_openssl_all), TEST_CASE_ST(ut_setup, ut_teardown, + test_DES_cipheronly_openssl_all), + TEST_CASE_ST(ut_setup, ut_teardown, test_DES_docsis_openssl_all), TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_openssl_all), @@ -8430,6 +8889,54 @@ static struct unit_test_suite cryptodev_openssl_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GMAC_authentication_verify_test_case_4), + /** AES CCM Authenticated Encryption 128 bits key */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_128_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_128_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_128_3), + + /** AES CCM Authenticated Decryption 128 bits key*/ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_128_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_128_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_128_3), + + /** AES CCM Authenticated Encryption 192 bits key */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_192_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_192_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_192_3), + + /** AES CCM Authenticated Decryption 192 bits key*/ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_192_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_192_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_192_3), + + /** AES CCM Authenticated Encryption 256 bits key */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_256_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_256_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_encryption_test_case_256_3), + + /** AES CCM Authenticated Decryption 256 bits key*/ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_256_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_256_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_CCM_authenticated_decryption_test_case_256_3), + /** Scatter-Gather */ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg), @@ -8779,6 +9286,101 @@ static struct unit_test_suite cryptodev_sw_zuc_testsuite = { } }; +static struct unit_test_suite cryptodev_dpaa_sec_testsuite = { + .suite_name = "Crypto DPAA_SEC Unit Test Suite", + .setup = testsuite_setup, + .teardown = testsuite_teardown, + .unit_test_cases = { + TEST_CASE_ST(ut_setup, ut_teardown, + test_device_configure_invalid_dev_id), + TEST_CASE_ST(ut_setup, ut_teardown, + test_multi_session), + + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_chain_dpaa_sec_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_3DES_chain_dpaa_sec_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_cipheronly_dpaa_sec_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_3DES_cipheronly_dpaa_sec_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_authonly_dpaa_sec_all), + + /** AES GCM Authenticated Encryption */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_encryption_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_encryption_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_encryption_test_case_3), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_encryption_test_case_4), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_encryption_test_case_5), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_encryption_test_case_6), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_encryption_test_case_7), + + /** AES GCM Authenticated Decryption */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_decryption_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_decryption_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_decryption_test_case_3), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_decryption_test_case_4), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_decryption_test_case_5), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_decryption_test_case_6), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_decryption_test_case_7), + + /** AES GCM Authenticated Encryption 256 bits key */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_256_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_256_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_256_3), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_256_4), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_256_5), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_256_6), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_256_7), + + /** AES GCM Authenticated Decryption 256 bits key */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_256_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_256_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_256_3), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_256_4), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_256_5), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_256_6), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_256_7), + + /** Out of place tests */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_encryption_oop_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_decryption_oop_test_case_1), + + TEST_CASES_END() /**< NULL terminate unit test array */ + } +}; + static struct unit_test_suite cryptodev_dpaa2_sec_testsuite = { .suite_name = "Crypto DPAA2_SEC Unit Test Suite", .setup = testsuite_setup, @@ -8896,6 +9498,12 @@ static struct unit_test_suite cryptodev_dpaa2_sec_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GCM_auth_decryption_test_case_256_7), + /** Out of place tests */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_encryption_oop_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_authenticated_decryption_oop_test_case_1), + TEST_CASES_END() /**< NULL terminate unit test array */ } }; @@ -8939,6 +9547,40 @@ static struct unit_test_suite cryptodev_armv8_testsuite = { } }; +static struct unit_test_suite cryptodev_mrvl_testsuite = { + .suite_name = "Crypto Device Marvell Component Test Suite", + .setup = testsuite_setup, + .teardown = testsuite_teardown, + .unit_test_cases = { + TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session), + TEST_CASE_ST(ut_setup, ut_teardown, + test_multi_session_random_usage), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_chain_mrvl_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_cipheronly_mrvl_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_authonly_mrvl_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_3DES_chain_mrvl_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_3DES_cipheronly_mrvl_all), + + /** Negative tests */ + TEST_CASE_ST(ut_setup, ut_teardown, + authentication_verify_HMAC_SHA1_fail_data_corrupt), + TEST_CASE_ST(ut_setup, ut_teardown, + authentication_verify_HMAC_SHA1_fail_tag_corrupt), + TEST_CASE_ST(ut_setup, ut_teardown, + auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt), + TEST_CASE_ST(ut_setup, ut_teardown, + auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt), + + TEST_CASES_END() /**< NULL terminate unit test array */ + } +}; + + static int test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/) { @@ -9083,6 +9725,22 @@ test_cryptodev_armv8(void) return unit_test_suite_runner(&cryptodev_armv8_testsuite); } +static int +test_cryptodev_mrvl(void) +{ + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_MRVL_PMD)); + + if (gbl_driver_id == -1) { + RTE_LOG(ERR, USER1, "MRVL PMD must be loaded. Check if " + "CONFIG_RTE_LIBRTE_PMD_MRVL_CRYPTO is enabled " + "in config file to run this testsuite.\n"); + return TEST_FAILED; + } + + return unit_test_suite_runner(&cryptodev_mrvl_testsuite); +} + #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER static int @@ -9127,6 +9785,22 @@ test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/) return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite); } +static int +test_cryptodev_dpaa_sec(void /*argv __rte_unused, int argc __rte_unused*/) +{ + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)); + + if (gbl_driver_id == -1) { + RTE_LOG(ERR, USER1, "DPAA SEC PMD must be loaded. Check if " + "CONFIG_RTE_LIBRTE_PMD_DPAA_SEC is enabled " + "in config file to run this testsuite.\n"); + return TEST_FAILED; + } + + return unit_test_suite_runner(&cryptodev_dpaa_sec_testsuite); +} + REGISTER_TEST_COMMAND(cryptodev_qat_autotest, test_cryptodev_qat); REGISTER_TEST_COMMAND(cryptodev_aesni_mb_autotest, test_cryptodev_aesni_mb); REGISTER_TEST_COMMAND(cryptodev_openssl_autotest, test_cryptodev_openssl); @@ -9136,4 +9810,6 @@ REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_autotest, test_cryptodev_sw_snow3g); REGISTER_TEST_COMMAND(cryptodev_sw_kasumi_autotest, test_cryptodev_sw_kasumi); REGISTER_TEST_COMMAND(cryptodev_sw_zuc_autotest, test_cryptodev_sw_zuc); REGISTER_TEST_COMMAND(cryptodev_sw_armv8_autotest, test_cryptodev_armv8); +REGISTER_TEST_COMMAND(cryptodev_sw_mrvl_autotest, test_cryptodev_mrvl); REGISTER_TEST_COMMAND(cryptodev_dpaa2_sec_autotest, test_cryptodev_dpaa2_sec); +REGISTER_TEST_COMMAND(cryptodev_dpaa_sec_autotest, test_cryptodev_dpaa_sec); diff --git a/test/test/test_cryptodev.h b/test/test/test_cryptodev.h index 4509a09a..26bfbe60 100644 --- a/test/test/test_cryptodev.h +++ b/test/test/test_cryptodev.h @@ -88,6 +88,7 @@ #define CRYPTODEV_NAME_ARMV8_PMD crypto_armv8 #define CRYPTODEV_NAME_DPAA2_SEC_PMD crypto_dpaa2_sec #define CRYPTODEV_NAME_SCHEDULER_PMD crypto_scheduler +#define CRYPTODEV_NAME_MRVL_PMD crypto_mrvl /** * Write (spread) data from buffer to mbuf data @@ -152,18 +153,18 @@ pktmbuf_mtod_offset(struct rte_mbuf *mbuf, int offset) { return rte_pktmbuf_mtod_offset(m, uint8_t *, offset); } -static inline phys_addr_t -pktmbuf_mtophys_offset(struct rte_mbuf *mbuf, int offset) { +static inline rte_iova_t +pktmbuf_iova_offset(struct rte_mbuf *mbuf, int offset) { struct rte_mbuf *m; for (m = mbuf; (m != NULL) && (offset > m->data_len); m = m->next) offset -= m->data_len; if (m == NULL) { - printf("pktmbuf_mtophys_offset: offset out of buffer\n"); + printf("pktmbuf_iova_offset: offset out of buffer\n"); return 0; } - return rte_pktmbuf_mtophys_offset(m, offset); + return rte_pktmbuf_iova_offset(m, offset); } static inline struct rte_mbuf * diff --git a/test/test/test_cryptodev_gcm_test_vectors.h b/test/test/test_cryptodev_aead_test_vectors.h index 7879c35b..e760ef93 100644 --- a/test/test/test_cryptodev_gcm_test_vectors.h +++ b/test/test/test_cryptodev_aead_test_vectors.h @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2015 Intel Corporation. All rights reserved. + * Copyright(c) 2015-2017 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,23 +30,34 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TEST_CRYPTODEV_GCM_TEST_VECTORS_H_ -#define TEST_CRYPTODEV_GCM_TEST_VECTORS_H_ +#ifndef TEST_CRYPTODEV_AEAD_TEST_VECTORS_H_ +#define TEST_CRYPTODEV_AEAD_TEST_VECTORS_H_ #define GMAC_LARGE_PLAINTEXT_LENGTH 65344 -#define GCM_MAX_AAD_LENGTH 65536 +#define MAX_AAD_LENGTH 65536 #define GCM_LARGE_AAD_LENGTH 65296 -static uint8_t gcm_aad_zero_text[GCM_MAX_AAD_LENGTH] = { 0 }; +static uint8_t gcm_aad_zero_text[MAX_AAD_LENGTH] = { 0 }; -static uint8_t gcm_aad_text[GCM_MAX_AAD_LENGTH] = { +static uint8_t gcm_aad_text[MAX_AAD_LENGTH] = { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0x00, 0xf1, 0xe2, 0xd3, 0xc4, 0xb5, 0xa6, 0x97, 0x88, 0x79, 0x6a, 0x5b, 0x4c, 0x3d, 0x2e, 0x1f }; +static uint8_t ccm_aad_test_1[8] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 +}; + +static uint8_t ccm_aad_test_2[22] = { + 0x08, 0x40, 0x0F, 0xD2, 0xE1, 0x28, 0xA5, 0x7C, + 0x50, 0x30, 0xF1, 0x84, 0x44, 0x08, 0xAB, 0xAE, + 0xA5, 0xB8, 0xFC, 0xBA, 0x00, 0x00 +}; + +struct aead_test_data { + enum rte_crypto_aead_algorithm algo; -struct gcm_test_data { struct { uint8_t data[64]; unsigned len; @@ -101,8 +112,9 @@ struct gmac_test_data { }; -/** AES-128 Test Vectors */ -static const struct gcm_test_data gcm_test_case_1 = { +/** AES-GCM-128 Test Vectors */ +static const struct aead_test_data gcm_test_case_1 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -138,8 +150,8 @@ static const struct gcm_test_data gcm_test_case_1 = { } }; -/** AES-128 Test Vectors */ -static const struct gcm_test_data gcm_test_case_2 = { +static const struct aead_test_data gcm_test_case_2 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -176,8 +188,8 @@ static const struct gcm_test_data gcm_test_case_2 = { } }; -/** AES-128 Test Vectors */ -static const struct gcm_test_data gcm_test_case_3 = { +static const struct aead_test_data gcm_test_case_3 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -227,8 +239,8 @@ static const struct gcm_test_data gcm_test_case_3 = { } }; -/** AES-128 Test Vectors */ -static const struct gcm_test_data gcm_test_case_4 = { +static const struct aead_test_data gcm_test_case_4 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -282,8 +294,8 @@ static const struct gcm_test_data gcm_test_case_4 = { }; -/** AES-128 Test Vectors */ -static const struct gcm_test_data gcm_test_case_5 = { +static const struct aead_test_data gcm_test_case_5 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -337,8 +349,8 @@ static const struct gcm_test_data gcm_test_case_5 = { }; -/** AES-128 Test Vectors */ -static const struct gcm_test_data gcm_test_case_6 = { +static const struct aead_test_data gcm_test_case_6 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -392,8 +404,8 @@ static const struct gcm_test_data gcm_test_case_6 = { } }; -/** AES-128 Test Vectors */ -static const struct gcm_test_data gcm_test_case_7 = { +static const struct aead_test_data gcm_test_case_7 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -447,7 +459,8 @@ static const struct gcm_test_data gcm_test_case_7 = { } }; -static const struct gcm_test_data gcm_test_case_8 = { +static const struct aead_test_data gcm_test_case_8 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -997,8 +1010,9 @@ static const struct gcm_test_data gcm_test_case_8 = { } }; -/** AES-192 Test Vectors */ -static const struct gcm_test_data gcm_test_case_192_1 = { +/** AES-GCM-192 Test Vectors */ +static const struct aead_test_data gcm_test_case_192_1 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1035,7 +1049,8 @@ static const struct gcm_test_data gcm_test_case_192_1 = { } }; -static const struct gcm_test_data gcm_test_case_192_2 = { +static const struct aead_test_data gcm_test_case_192_2 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1079,7 +1094,8 @@ static const struct gcm_test_data gcm_test_case_192_2 = { } }; -static const struct gcm_test_data gcm_test_case_192_3 = { +static const struct aead_test_data gcm_test_case_192_3 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, @@ -1134,7 +1150,8 @@ static const struct gcm_test_data gcm_test_case_192_3 = { } }; -static const struct gcm_test_data gcm_test_case_192_4 = { +static const struct aead_test_data gcm_test_case_192_4 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, @@ -1189,7 +1206,8 @@ static const struct gcm_test_data gcm_test_case_192_4 = { } }; -static const struct gcm_test_data gcm_test_case_192_5 = { +static const struct aead_test_data gcm_test_case_192_5 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, @@ -1244,7 +1262,8 @@ static const struct gcm_test_data gcm_test_case_192_5 = { } }; -static const struct gcm_test_data gcm_test_case_192_6 = { +static const struct aead_test_data gcm_test_case_192_6 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, @@ -1299,7 +1318,8 @@ static const struct gcm_test_data gcm_test_case_192_6 = { } }; -static const struct gcm_test_data gcm_test_case_192_7 = { +static const struct aead_test_data gcm_test_case_192_7 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, @@ -1354,8 +1374,9 @@ static const struct gcm_test_data gcm_test_case_192_7 = { } }; -/** AES-256 Test Vectors */ -static const struct gcm_test_data gcm_test_case_256_1 = { +/** AES-GCM-256 Test Vectors */ +static const struct aead_test_data gcm_test_case_256_1 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1390,8 +1411,8 @@ static const struct gcm_test_data gcm_test_case_256_1 = { } }; -/** AES-256 Test Vectors */ -static const struct gcm_test_data gcm_test_case_256_2 = { +static const struct aead_test_data gcm_test_case_256_2 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1430,8 +1451,8 @@ static const struct gcm_test_data gcm_test_case_256_2 = { } }; -/** AES-256 Test Vectors */ -static const struct gcm_test_data gcm_test_case_256_3 = { +static const struct aead_test_data gcm_test_case_256_3 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -1482,8 +1503,8 @@ static const struct gcm_test_data gcm_test_case_256_3 = { } }; -/** AES-256 Test Vectors */ -static const struct gcm_test_data gcm_test_case_256_4 = { +static const struct aead_test_data gcm_test_case_256_4 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -1535,8 +1556,8 @@ static const struct gcm_test_data gcm_test_case_256_4 = { }; -/** AES-256 Test Vectors */ -static const struct gcm_test_data gcm_test_case_256_5 = { +static const struct aead_test_data gcm_test_case_256_5 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -1588,8 +1609,8 @@ static const struct gcm_test_data gcm_test_case_256_5 = { }; -/** AES-256 Test Vectors */ -static const struct gcm_test_data gcm_test_case_256_6 = { +static const struct aead_test_data gcm_test_case_256_6 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -1640,8 +1661,8 @@ static const struct gcm_test_data gcm_test_case_256_6 = { } }; -/** AES-256 Test Vectors */ -static const struct gcm_test_data gcm_test_case_256_7 = { +static const struct aead_test_data gcm_test_case_256_7 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -1692,8 +1713,9 @@ static const struct gcm_test_data gcm_test_case_256_7 = { } }; -/** variable AAD AES-128 Test Vectors */ -static const struct gcm_test_data gcm_test_case_aad_1 = { +/** variable AAD AES-GCM-128 Test Vectors */ +static const struct aead_test_data gcm_test_case_aad_1 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -1744,8 +1766,9 @@ static const struct gcm_test_data gcm_test_case_aad_1 = { } }; -/** variable AAD AES-256 Test Vectors */ -static const struct gcm_test_data gcm_test_case_aad_2 = { +/** variable AAD AES-GCM-256 Test Vectors */ +static const struct aead_test_data gcm_test_case_aad_2 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -2567,7 +2590,8 @@ static const struct gmac_test_data gmac_test_case_4 = { } }; -static const struct gcm_test_data gcm_test_case_SGL_1 = { +static const struct aead_test_data gcm_test_case_SGL_1 = { + .algo = RTE_CRYPTO_AEAD_AES_GCM, .key = { .data = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, @@ -3384,4 +3408,396 @@ static const struct gcm_test_data gcm_test_case_SGL_1 = { } }; -#endif /* TEST_CRYPTODEV_GCM_TEST_VECTORS_H_ */ +/** AES-CCM-128 Test Vectors */ +static const struct aead_test_data ccm_test_case_128_1 = { + .algo = RTE_CRYPTO_AEAD_AES_CCM, + .key = { + .data = { + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F + }, + .len = 16 + }, + .iv = { + .data = { + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 + }, + .len = 7 + }, + .aad = { + .data = ccm_aad_test_1, + .len = 8 + }, + .plaintext = { + .data = { + 0x20, 0x21, 0x22, 0x23 + }, + .len = 4 + }, + .ciphertext = { + .data = { + 0x71, 0x62, 0x01, 0x5B + }, + .len = 4 + }, + .auth_tag = { + .data = { + 0x4D, 0xAC, 0x25, 0x5D + }, + .len = 4 + } +}; + +static const struct aead_test_data ccm_test_case_128_2 = { + .algo = RTE_CRYPTO_AEAD_AES_CCM, + .key = { + .data = { + 0xC9, 0x7C, 0x1F, 0x67, 0xCE, 0x37, 0x11, 0x85, + 0x51, 0x4A, 0x8A, 0x19, 0xF2, 0xBD, 0xD5, 0x2F + }, + .len = 16 + }, + .iv = { + .data = { + 0x00, 0x50, 0x30, 0xF1, 0x84, 0x44, 0x08, 0xB5, + 0x03, 0x97, 0x76, 0xE7, 0x0C + }, + .len = 13 + }, + .aad = { + .data = ccm_aad_test_2, + .len = 22 + }, + .plaintext = { + .data = { + 0xF8, 0xBA, 0x1A, 0x55, 0xD0, 0x2F, 0x85, 0xAE, + 0x96, 0x7B, 0xB6, 0x2F, 0xB6, 0xCD, 0xA8, 0xEB, + 0x7E, 0x78, 0xA0, 0x50 + }, + .len = 20 + }, + .ciphertext = { + .data = { + 0xF3, 0xD0, 0xA2, 0xFE, 0x9A, 0x3D, 0xBF, 0x23, + 0x42, 0xA6, 0x43, 0xE4, 0x32, 0x46, 0xE8, 0x0C, + 0x3C, 0x04, 0xD0, 0x19 + }, + .len = 20 + }, + .auth_tag = { + .data = { + 0x78, 0x45, 0xCE, 0x0B, 0x16, 0xF9, 0x76, 0x23 + }, + .len = 8 + } +}; + +static const struct aead_test_data ccm_test_case_128_3 = { + .algo = RTE_CRYPTO_AEAD_AES_CCM, + .key = { + .data = { + 0xC9, 0x7C, 0x1F, 0x67, 0xCE, 0x37, 0x11, 0x85, + 0x51, 0x4A, 0x8A, 0x19, 0xF2, 0xBD, 0xD5, 0x2F + }, + .len = 16 + }, + .iv = { + .data = { + 0x00, 0x50, 0x30, 0xF1, 0x84, 0x44, 0x08, 0xB5, + 0x03, 0x97, 0x76, 0xE7, 0x0C + }, + .len = 13 + }, + .aad = { + .data = gcm_aad_zero_text, + .len = 0 + }, + .plaintext = { + .data = { + 0xF8, 0xBA, 0x1A, 0x55, 0xD0, 0x2F, 0x85, 0xAE, + 0x96, 0x7B, 0xB6, 0x2F, 0xB6, 0xCD, 0xA8, 0xEB, + 0x7E, 0x78, 0xA0, 0x50 + }, + .len = 20 + }, + .ciphertext = { + .data = { + 0xF3, 0xD0, 0xA2, 0xFE, 0x9A, 0x3D, 0xBF, 0x23, + 0x42, 0xA6, 0x43, 0xE4, 0x32, 0x46, 0xE8, 0x0C, + 0x3C, 0x04, 0xD0, 0x19 + }, + .len = 20 + }, + .auth_tag = { + .data = { + 0x41, 0x83, 0x21, 0x89, 0xA3, 0xD3, 0x1B, 0x43 + }, + .len = 8 + } +}; + +/** AES-CCM-192 Test Vectors */ +static const struct aead_test_data ccm_test_case_192_1 = { + .algo = RTE_CRYPTO_AEAD_AES_CCM, + .key = { + .data = { + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57 + }, + .len = 24 + }, + .iv = { + .data = { + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 + }, + .len = 7 + }, + .aad = { + .data = ccm_aad_test_1, + .len = 8 + }, + .plaintext = { + .data = { + 0x20, 0x21, 0x22, 0x23 + }, + .len = 4 + }, + .ciphertext = { + .data = { + 0x18, 0xEE, 0x17, 0x30 + }, + .len = 4 + }, + .auth_tag = { + .data = { + 0xC8, 0xC3, 0x26, 0xD5 + }, + .len = 4 + } +}; + +static const struct aead_test_data ccm_test_case_192_2 = { + .algo = RTE_CRYPTO_AEAD_AES_CCM, + .key = { + .data = { + 0xC9, 0x7C, 0x1F, 0x67, 0xCE, 0x37, 0x11, 0x85, + 0x51, 0x4A, 0x8A, 0x19, 0xF2, 0xBD, 0xD5, 0x2F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57 + }, + .len = 24 + }, + .iv = { + .data = { + 0x00, 0x50, 0x30, 0xF1, 0x84, 0x44, 0x08, 0xB5, + 0x03, 0x97, 0x76, 0xE7, 0x0C + }, + .len = 13 + }, + .aad = { + .data = ccm_aad_test_2, + .len = 22 + }, + .plaintext = { + .data = { + 0xF8, 0xBA, 0x1A, 0x55, 0xD0, 0x2F, 0x85, 0xAE, + 0x96, 0x7B, 0xB6, 0x2F, 0xB6, 0xCD, 0xA8, 0xEB, + 0x7E, 0x78, 0xA0, 0x50 + }, + .len = 20 + }, + .ciphertext = { + .data = { + 0x41, 0xC6, 0x2D, 0xD5, 0x31, 0xF2, 0xD5, 0xC8, + 0xCC, 0x57, 0x01, 0x2E, 0x7E, 0x2B, 0xF1, 0x26, + 0x6A, 0xC7, 0xCB, 0xA5 + }, + .len = 20 + }, + .auth_tag = { + .data = { + 0x77, 0xA3, 0x41, 0xD5, 0x2A, 0xE3, 0x25, 0x37 + }, + .len = 8 + } +}; + +static const struct aead_test_data ccm_test_case_192_3 = { + .algo = RTE_CRYPTO_AEAD_AES_CCM, + .key = { + .data = { + 0xC9, 0x7C, 0x1F, 0x67, 0xCE, 0x37, 0x11, 0x85, + 0x51, 0x4A, 0x8A, 0x19, 0xF2, 0xBD, 0xD5, 0x2F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57 + }, + .len = 24 + }, + .iv = { + .data = { + 0x00, 0x50, 0x30, 0xF1, 0x84, 0x44, 0x08, 0xB5, + 0x03, 0x97, 0x76, 0xE7, 0x0C + }, + .len = 13 + }, + .aad = { + .data = gcm_aad_zero_text, + .len = 0 + }, + .plaintext = { + .data = { + 0xF8, 0xBA, 0x1A, 0x55, 0xD0, 0x2F, 0x85, 0xAE, + 0x96, 0x7B, 0xB6, 0x2F, 0xB6, 0xCD, 0xA8, 0xEB, + 0x7E, 0x78, 0xA0, 0x50 + }, + .len = 20 + }, + .ciphertext = { + .data = { + 0x41, 0xC6, 0x2D, 0xD5, 0x31, 0xF2, 0xD5, 0xC8, + 0xCC, 0x57, 0x01, 0x2E, 0x7E, 0x2B, 0xF1, 0x26, + 0x6A, 0xC7, 0xCB, 0xA5 + }, + .len = 20 + }, + .auth_tag = { + .data = { + 0x84, 0x72, 0x6E, 0xE7, 0x8E, 0x8E, 0x3A, 0xC6 + }, + .len = 8 + } +}; + +/** AES-CCM-256 Test Vectors */ +static const struct aead_test_data ccm_test_case_256_1 = { + .algo = RTE_CRYPTO_AEAD_AES_CCM, + .key = { + .data = { + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F + }, + .len = 32 + }, + .iv = { + .data = { + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 + }, + .len = 7 + }, + .aad = { + .data = ccm_aad_test_1, + .len = 8 + }, + .plaintext = { + .data = { + 0x20, 0x21, 0x22, 0x23 + }, + .len = 4 + }, + .ciphertext = { + .data = { + 0x8A, 0xB1, 0xA8, 0x74 + }, + .len = 4 + }, + .auth_tag = { + .data = { + 0x95, 0xFC, 0x08, 0x20 + }, + .len = 4 + } +}; + +static const struct aead_test_data ccm_test_case_256_2 = { + .algo = RTE_CRYPTO_AEAD_AES_CCM, + .key = { + .data = { + 0xC9, 0x7C, 0x1F, 0x67, 0xCE, 0x37, 0x11, 0x85, + 0x51, 0x4A, 0x8A, 0x19, 0xF2, 0xBD, 0xD5, 0x2F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F + }, + .len = 32 + }, + .iv = { + .data = { + 0x00, 0x50, 0x30, 0xF1, 0x84, 0x44, 0x08, 0xB5, + 0x03, 0x97, 0x76, 0xE7, 0x0C + }, + .len = 13 + }, + .aad = { + .data = ccm_aad_test_2, + .len = 22 + }, + .plaintext = { + .data = { + 0xF8, 0xBA, 0x1A, 0x55, 0xD0, 0x2F, 0x85, 0xAE, + 0x96, 0x7B, 0xB6, 0x2F, 0xB6, 0xCD, 0xA8, 0xEB, + 0x7E, 0x78, 0xA0, 0x50 + }, + .len = 20 + }, + .ciphertext = { + .data = { + 0x25, 0x82, 0x89, 0x09, 0x3E, 0x39, 0x1F, 0x16, + 0xD2, 0x82, 0x3D, 0xF6, 0xCE, 0x97, 0x72, 0x07, + 0xEC, 0x23, 0x17, 0x98 + }, + .len = 20 + }, + .auth_tag = { + .data = { + 0xAB, 0x02, 0xE9, 0xD1, 0x16, 0x69, 0xED, 0x0A + }, + .len = 8 + } +}; + +static const struct aead_test_data ccm_test_case_256_3 = { + .algo = RTE_CRYPTO_AEAD_AES_CCM, + .key = { + .data = { + 0xC9, 0x7C, 0x1F, 0x67, 0xCE, 0x37, 0x11, 0x85, + 0x51, 0x4A, 0x8A, 0x19, 0xF2, 0xBD, 0xD5, 0x2F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F + }, + .len = 32 + }, + .iv = { + .data = { + 0x00, 0x50, 0x30, 0xF1, 0x84, 0x44, 0x08, 0xB5, + 0x03, 0x97, 0x76, 0xE7, 0x0C + }, + .len = 13 + }, + .aad = { + .data = gcm_aad_zero_text, + .len = 0 + }, + .plaintext = { + .data = { + 0xF8, 0xBA, 0x1A, 0x55, 0xD0, 0x2F, 0x85, 0xAE, + 0x96, 0x7B, 0xB6, 0x2F, 0xB6, 0xCD, 0xA8, 0xEB, + 0x7E, 0x78, 0xA0, 0x50 + }, + .len = 20 + }, + .ciphertext = { + .data = { + 0x25, 0x82, 0x89, 0x09, 0x3E, 0x39, 0x1F, 0x16, + 0xD2, 0x82, 0x3D, 0xF6, 0xCE, 0x97, 0x72, 0x07, + 0xEC, 0x23, 0x17, 0x98 + }, + .len = 20 + }, + .auth_tag = { + .data = { + 0x15, 0x80, 0xC4, 0xC9, 0x3F, 0xAB, 0x2A, 0xFD + }, + .len = 8 + } +}; +#endif /* TEST_CRYPTODEV_AEAD_TEST_VECTORS_H_ */ diff --git a/test/test/test_cryptodev_aes_test_vectors.h b/test/test/test_cryptodev_aes_test_vectors.h index e410018f..9c13041d 100644 --- a/test/test/test_cryptodev_aes_test_vectors.h +++ b/test/test/test_cryptodev_aes_test_vectors.h @@ -1197,7 +1197,9 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CTR HMAC-SHA1 Decryption Digest " @@ -1208,7 +1210,9 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-192-CTR XCBC Encryption Digest", @@ -1245,7 +1249,9 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-256-CTR HMAC-SHA1 Decryption Digest " @@ -1256,7 +1262,9 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest", @@ -1267,14 +1275,17 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest " "(short buffers)", .test_data = &aes_test_data_13, .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest " @@ -1298,14 +1309,17 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " "Verify (short buffers)", .test_data = &aes_test_data_13, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA256 Encryption Digest", @@ -1316,14 +1330,17 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA256 Encryption Digest " "(short buffers)", .test_data = &aes_test_data_12, .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA256 Decryption Digest " @@ -1335,14 +1352,17 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA256 Decryption Digest " "Verify (short buffers)", .test_data = &aes_test_data_12, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest", @@ -1352,7 +1372,9 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest " @@ -1383,7 +1405,9 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA512 Decryption Digest " @@ -1421,7 +1445,9 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 | BLOCKCIPHER_TEST_TARGET_PMD_QAT | - BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " @@ -1431,7 +1457,9 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 | BLOCKCIPHER_TEST_TARGET_PMD_QAT | - BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "AES-128-CBC HMAC-SHA224 Encryption Digest", @@ -1441,7 +1469,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "AES-128-CBC HMAC-SHA224 Decryption Digest " @@ -1452,7 +1481,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "AES-128-CBC HMAC-SHA384 Encryption Digest", @@ -1462,7 +1492,9 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA384 Decryption Digest " @@ -1473,7 +1505,9 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest " @@ -1505,7 +1539,9 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CBC Decryption", @@ -1515,7 +1551,9 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-192-CBC Encryption", @@ -1525,7 +1563,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "AES-192-CBC Encryption Scater gather", @@ -1543,7 +1582,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "AES-256-CBC Encryption", @@ -1553,7 +1593,9 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-256-CBC Decryption", @@ -1563,7 +1605,9 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-256-CBC OOP Encryption", @@ -1571,7 +1615,9 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_QAT + BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "AES-256-CBC OOP Decryption", @@ -1579,7 +1625,9 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_QAT + BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "AES-128-CTR Encryption", @@ -1589,7 +1637,9 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CTR Decryption", @@ -1599,7 +1649,9 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-192-CTR Encryption", @@ -1609,7 +1661,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "AES-192-CTR Decryption", @@ -1619,7 +1672,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "AES-256-CTR Encryption", @@ -1629,7 +1683,9 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-256-CTR Decryption", @@ -1639,7 +1695,9 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_QAT | BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "AES-128-CTR Encryption (12-byte IV)", diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c index 6089af4e..20f3296d 100644 --- a/test/test/test_cryptodev_blockcipher.c +++ b/test/test/test_cryptodev_blockcipher.c @@ -92,6 +92,10 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); int dpaa2_sec_pmd = rte_cryptodev_driver_id_get( RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)); + int dpaa_sec_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)); + int mrvl_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_MRVL_PMD)); int nb_segs = 1; @@ -114,9 +118,11 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, tdata->auth_key.len); if (driver_id == dpaa2_sec_pmd || + driver_id == dpaa_sec_pmd || driver_id == qat_pmd || driver_id == openssl_pmd || - driver_id == armv8_pmd) { /* Fall through */ + driver_id == armv8_pmd || + driver_id == mrvl_pmd) { /* Fall through */ digest_len = tdata->digest.len; } else if (driver_id == aesni_mb_pmd || driver_id == scheduler_pmd) { @@ -323,14 +329,14 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, sym_op->auth.digest.data = pktmbuf_mtod_offset (iobuf, digest_offset); sym_op->auth.digest.phys_addr = - pktmbuf_mtophys_offset(iobuf, + pktmbuf_iova_offset(iobuf, digest_offset); } else { auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; sym_op->auth.digest.data = pktmbuf_mtod_offset (sym_op->m_src, digest_offset); sym_op->auth.digest.phys_addr = - pktmbuf_mtophys_offset(sym_op->m_src, + pktmbuf_iova_offset(sym_op->m_src, digest_offset); } @@ -452,25 +458,13 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) { struct rte_mbuf *mbuf; uint8_t value; - uint32_t head_unchanged_len = 0, changed_len = 0; + uint32_t head_unchanged_len, changed_len = 0; uint32_t i; mbuf = sym_op->m_src; - if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) { - /* white-box test: PMDs use some of the - * tailroom as temp storage in verify case - */ - head_unchanged_len = rte_pktmbuf_headroom(mbuf) - + rte_pktmbuf_data_len(mbuf); - changed_len = digest_len; - } else { - head_unchanged_len = mbuf->buf_len; - changed_len = 0; - } + head_unchanged_len = mbuf->buf_len; for (i = 0; i < mbuf->buf_len; i++) { - if (i == head_unchanged_len) - i += changed_len; value = *((uint8_t *)(mbuf->buf_addr)+i); if (value != tmp_src_buf[i]) { snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, @@ -531,19 +525,6 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) changed_len += digest_len; - if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) { - /* white-box test: PMDs use some of the - * tailroom as temp storage in verify case - */ - if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) { - /* This is simplified, not checking digest*/ - changed_len += digest_len*2; - } else { - head_unchanged_len += digest_len; - changed_len += digest_len; - } - } - for (i = 0; i < mbuf->buf_len; i++) { if (i == head_unchanged_len) i += changed_len; @@ -602,8 +583,10 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, int openssl_pmd = rte_cryptodev_driver_id_get( RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)); - int dpaa2_pmd = rte_cryptodev_driver_id_get( + int dpaa2_sec_pmd = rte_cryptodev_driver_id_get( RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)); + int dpaa_sec_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)); int scheduler_pmd = rte_cryptodev_driver_id_get( RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)); int armv8_pmd = rte_cryptodev_driver_id_get( @@ -612,6 +595,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); int qat_pmd = rte_cryptodev_driver_id_get( RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); + int mrvl_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_MRVL_PMD)); switch (test_type) { case BLKCIPHER_AES_CHAIN_TYPE: @@ -668,8 +653,12 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8; else if (driver_id == scheduler_pmd) target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER; - else if (driver_id == dpaa2_pmd) + else if (driver_id == dpaa2_sec_pmd) target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC; + else if (driver_id == dpaa_sec_pmd) + target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC; + else if (driver_id == mrvl_pmd) + target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MRVL; else TEST_ASSERT(0, "Unrecognized cryptodev type"); diff --git a/test/test/test_cryptodev_blockcipher.h b/test/test/test_cryptodev_blockcipher.h index 22b8d206..67c78d47 100644 --- a/test/test/test_cryptodev_blockcipher.h +++ b/test/test/test_cryptodev_blockcipher.h @@ -53,6 +53,8 @@ #define BLOCKCIPHER_TEST_TARGET_PMD_ARMV8 0x0008 /* ARMv8 flag */ #define BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER 0x0010 /* Scheduler */ #define BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC 0x0020 /* DPAA2_SEC flag */ +#define BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC 0x0040 /* DPAA_SEC flag */ +#define BLOCKCIPHER_TEST_TARGET_PMD_MRVL 0x0080 /* Marvell flag */ #define BLOCKCIPHER_TEST_OP_CIPHER (BLOCKCIPHER_TEST_OP_ENCRYPT | \ BLOCKCIPHER_TEST_OP_DECRYPT) diff --git a/test/test/test_cryptodev_des_test_vectors.h b/test/test/test_cryptodev_des_test_vectors.h index 0b6e0b8d..d09e23de 100644 --- a/test/test/test_cryptodev_des_test_vectors.h +++ b/test/test/test_cryptodev_des_test_vectors.h @@ -851,13 +851,19 @@ static const struct blockcipher_test_case des_cipheronly_test_cases[] = { .test_descr = "DES-CBC Encryption", .test_data = &des_cbc_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_MB | + BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "DES-CBC Decryption", .test_data = &des_cbc_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_MB | + BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, }; @@ -965,42 +971,48 @@ static const struct blockcipher_test_case des_docsis_test_cases[] = { .test_data = &des_test_data_1, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_QAT + BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "DES-DOCSIS-BPI Runt Block Encryption", .test_data = &des_test_data_2, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_QAT + BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "DES-DOCSIS-BPI Uneven Encryption", .test_data = &des_test_data_3, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_QAT + BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "DES-DOCSIS-BPI Full Block Decryption", .test_data = &des_test_data_1, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_QAT + BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "DES-DOCSIS-BPI Runt Block Decryption", .test_data = &des_test_data_2, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_QAT + BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "DES-DOCSIS-BPI Uneven Decryption", .test_data = &des_test_data_3, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_QAT + BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_MB }, { .test_descr = "DES-DOCSIS-BPI OOP Full Block Encryption", @@ -1059,7 +1071,8 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "3DES-128-CBC HMAC-SHA1 Decryption Digest Verify", @@ -1067,7 +1080,8 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "3DES-128-CBC SHA1 Encryption Digest", @@ -1087,7 +1101,9 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "3DES-192-CBC HMAC-SHA1 Decryption Digest Verify", @@ -1095,19 +1111,23 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "3DES-192-CBC SHA1 Encryption Digest", .test_data = &triple_des192cbc_sha1_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "3DES-192-CBC SHA1 Decryption Digest Verify", .test_data = &triple_des192cbc_sha1_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "3DES-128-CTR HMAC-SHA1 Encryption Digest", @@ -1167,7 +1187,9 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_QAT + BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "3DES-128-CBC HMAC-SHA1 Decryption Digest" @@ -1176,7 +1198,9 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | - BLOCKCIPHER_TEST_TARGET_PMD_QAT + BLOCKCIPHER_TEST_TARGET_PMD_QAT | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "3DES-128-CBC HMAC-SHA1 Encryption Digest" @@ -1204,7 +1228,8 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "3DES-128-CBC Decryption", @@ -1212,7 +1237,8 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC }, { .test_descr = "3DES-192-CBC Encryption", @@ -1220,7 +1246,9 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "3DES-192-CBC Decryption", @@ -1228,7 +1256,9 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_QAT | - BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC + BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_MRVL }, { .test_descr = "3DES-128-CTR Encryption", diff --git a/test/test/test_cryptodev_hash_test_vectors.h b/test/test/test_cryptodev_hash_test_vectors.h index b7fe9d9c..3b840ce6 100644 --- a/test/test/test_cryptodev_hash_test_vectors.h +++ b/test/test/test_cryptodev_hash_test_vectors.h @@ -368,6 +368,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { @@ -378,6 +379,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { @@ -400,6 +402,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { @@ -410,6 +413,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { @@ -432,6 +436,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { @@ -442,6 +447,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { @@ -464,6 +470,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { @@ -474,6 +481,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { @@ -496,6 +504,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { @@ -506,6 +515,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { @@ -528,6 +538,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { @@ -538,6 +549,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER | BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC | + BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | BLOCKCIPHER_TEST_TARGET_PMD_QAT }, }; diff --git a/test/test/test_cryptodev_perf.c b/test/test/test_cryptodev_perf.c deleted file mode 100644 index 3b57e6d0..00000000 --- a/test/test/test_cryptodev_perf.c +++ /dev/null @@ -1,4932 +0,0 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2015-2017 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <rte_common.h> -#include <rte_mbuf.h> -#include <rte_malloc.h> -#include <rte_memcpy.h> - -#include <rte_crypto.h> -#include <rte_cryptodev.h> -#include <rte_cycles.h> - -#include "test.h" -#include "test_cryptodev.h" -#include "test_cryptodev_gcm_test_vectors.h" - -#define AES_CIPHER_IV_LENGTH 16 -#define TRIPLE_DES_CIPHER_IV_LENGTH 8 -#define AES_GCM_AAD_LENGTH 16 - -#define PERF_NUM_OPS_INFLIGHT (128) -#define DEFAULT_NUM_REQS_TO_SUBMIT (10000000) - -struct crypto_testsuite_params { - struct rte_mempool *mbuf_mp; - struct rte_mempool *op_mpool; - struct rte_mempool *sess_mp; - - uint16_t nb_queue_pairs; - - struct rte_cryptodev_config conf; - struct rte_cryptodev_qp_conf qp_conf; - uint8_t dev_id; -}; - -enum chain_mode { - CIPHER_HASH, - HASH_CIPHER, - CIPHER_ONLY, - HASH_ONLY, - AEAD -}; - - -struct symmetric_op { - const uint8_t *aad_data; - - const uint8_t *p_data; - uint32_t p_len; - - const uint8_t *c_data; - uint32_t c_len; - - const uint8_t *t_data; - uint32_t t_len; - -}; - -struct symmetric_session_attrs { - enum rte_crypto_cipher_operation cipher; - enum rte_crypto_auth_operation auth; - enum rte_crypto_aead_operation aead; - - enum rte_crypto_cipher_algorithm cipher_algorithm; - const uint8_t *key_cipher_data; - uint32_t key_cipher_len; - - enum rte_crypto_auth_algorithm auth_algorithm; - const uint8_t *key_auth_data; - uint32_t key_auth_len; - - enum rte_crypto_aead_algorithm aead_algorithm; - const uint8_t *key_aead_data; - uint32_t key_aead_len; - - const uint8_t *iv_data; - uint16_t iv_len; - uint16_t aad_len; - uint32_t digest_len; -}; - -static struct rte_cryptodev_sym_session *test_crypto_session; - -#define ALIGN_POW2_ROUNDUP(num, align) \ - (((num) + (align) - 1) & ~((align) - 1)) - -/* - * This struct is needed to avoid unnecessary allocation or checking - * of allocation of crypto params with current alloc on the fly - * implementation. - */ - -struct crypto_params { - uint8_t *aad; - uint8_t *digest; -}; - -struct perf_test_params { - - unsigned total_operations; - unsigned burst_size; - unsigned buf_size; - - enum chain_mode chain; - - enum rte_crypto_cipher_algorithm cipher_algo; - unsigned int key_length; - enum rte_crypto_auth_algorithm auth_algo; - enum rte_crypto_aead_algorithm aead_algo; - - struct symmetric_session_attrs *session_attrs; - - struct symmetric_op *symmetric_op; -}; - -#define MAX_NUM_OF_OPS_PER_UT (128) - -struct crypto_unittest_params { - struct rte_crypto_sym_xform cipher_xform; - struct rte_crypto_sym_xform auth_xform; - - struct rte_cryptodev_sym_session *sess; - - struct rte_crypto_op *op; - - struct rte_mbuf *obuf[MAX_NUM_OF_OPS_PER_UT]; - struct rte_mbuf *ibuf[MAX_NUM_OF_OPS_PER_UT]; - - uint8_t *digest; -}; - -static int -test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain, - enum rte_crypto_cipher_algorithm cipher_algo, - unsigned int cipher_key_len, - enum rte_crypto_auth_algorithm auth_algo); -static int -test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain, - enum rte_crypto_cipher_algorithm cipher_algo, - unsigned int cipher_key_len, - enum rte_crypto_auth_algorithm auth_algo, - enum rte_crypto_aead_algorithm aead_algo); -static int -test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain, - enum rte_crypto_cipher_algorithm cipher_algo, - unsigned int cipher_key_len, - enum rte_crypto_auth_algorithm auth_algo); - -static struct rte_mbuf * -test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz); -static inline struct rte_crypto_op * -test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m, - struct rte_cryptodev_sym_session *sess, unsigned int data_len); -static inline struct rte_crypto_op * -test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m, - struct rte_cryptodev_sym_session *sess, unsigned int data_len, - enum chain_mode chain); -static inline struct rte_crypto_op * -test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m, - struct rte_cryptodev_sym_session *sess, unsigned int data_len, - enum chain_mode chain __rte_unused); -static inline struct rte_crypto_op * -test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m, - struct rte_cryptodev_sym_session *sess, unsigned int data_len, - enum chain_mode chain __rte_unused); -static uint32_t get_auth_digest_length(enum rte_crypto_auth_algorithm algo); - - -static const char *chain_mode_name(enum chain_mode mode) -{ - switch (mode) { - case CIPHER_HASH: return "cipher_hash"; break; - case HASH_CIPHER: return "hash_cipher"; break; - case CIPHER_ONLY: return "cipher_only"; break; - case HASH_ONLY: return "hash_only"; break; - case AEAD: return "aead"; break; - default: return ""; break; - } -} - -static const char *pmd_name(uint8_t driver_id) -{ - uint8_t null_pmd = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_NULL_PMD)); - uint8_t dpaa2_pmd = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)); - uint8_t snow3g_pmd = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)); - uint8_t aesni_gcm_pmd = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD)); - uint8_t aesni_mb_pmd = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); - uint8_t qat_pmd = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); - - if (driver_id == null_pmd) - return RTE_STR(CRYPTODEV_NAME_NULL_PMD); - else if (driver_id == aesni_gcm_pmd) - return RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD); - else if (driver_id == aesni_mb_pmd) - return RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD); - else if (driver_id == qat_pmd) - return RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD); - else if (driver_id == snow3g_pmd) - return RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD); - else if (driver_id == dpaa2_pmd) - return RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD); - else - return ""; -} - -static struct rte_mbuf * -setup_test_string(struct rte_mempool *mpool, - const uint8_t *data, size_t len, uint8_t blocksize) -{ - struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); - size_t t_len = len - (blocksize ? (len % blocksize) : 0); - - if (m) { - char *dst = rte_pktmbuf_append(m, t_len); - - if (!dst) { - rte_pktmbuf_free(m); - return NULL; - } - - rte_memcpy(dst, (const void *)data, t_len); - } - return m; -} - -static struct crypto_testsuite_params testsuite_params = { NULL }; -static struct crypto_unittest_params unittest_params; -static int gbl_driver_id; - -static int -testsuite_setup(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct rte_cryptodev_info info; - unsigned i, nb_devs, valid_dev_id = 0; - int ret; - uint16_t qp_id; - - ts_params->mbuf_mp = rte_mempool_lookup("CRYPTO_PERF_MBUFPOOL"); - if (ts_params->mbuf_mp == NULL) { - /* Not already created so create */ - ts_params->mbuf_mp = rte_pktmbuf_pool_create( - "CRYPTO_PERF_MBUFPOOL", - NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE, - rte_socket_id()); - if (ts_params->mbuf_mp == NULL) { - RTE_LOG(ERR, USER1, "Can't create CRYPTO_PERF_MBUFPOOL\n"); - return TEST_FAILED; - } - } - - - ts_params->op_mpool = rte_crypto_op_pool_create("CRYPTO_OP_POOL", - RTE_CRYPTO_OP_TYPE_SYMMETRIC, - NUM_MBUFS, MBUF_CACHE_SIZE, - DEFAULT_NUM_XFORMS * - sizeof(struct rte_crypto_sym_xform) + - MAXIMUM_IV_LENGTH, - rte_socket_id()); - if (ts_params->op_mpool == NULL) { - RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); - return TEST_FAILED; - } - - /* Create an AESNI MB device if required */ - if (gbl_driver_id == rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) { - nb_devs = rte_cryptodev_device_count_by_driver( - rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))); - if (nb_devs < 1) { - ret = rte_vdev_init( - RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL); - - TEST_ASSERT(ret == 0, - "Failed to create instance of pmd : %s", - RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); - } - } - - /* Create an AESNI GCM device if required */ - if (gbl_driver_id == rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))) { - nb_devs = rte_cryptodev_device_count_by_driver( - rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))); - if (nb_devs < 1) { - ret = rte_vdev_init( - RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL); - - TEST_ASSERT(ret == 0, - "Failed to create instance of pmd : %s", - RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD)); - } - } - - /* Create a SNOW3G device if required */ - if (gbl_driver_id == rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD))) { - nb_devs = rte_cryptodev_device_count_by_driver( - rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD))); - if (nb_devs < 1) { - ret = rte_vdev_init( - RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL); - - TEST_ASSERT(ret == 0, - "Failed to create instance of pmd : %s", - RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)); - } - } - - /* Create an OPENSSL device if required */ - if (gbl_driver_id == rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD))) { - nb_devs = rte_cryptodev_device_count_by_driver( - rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD))); - if (nb_devs < 1) { - ret = rte_vdev_init( - RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD), - NULL); - - TEST_ASSERT(ret == 0, "Failed to create " - "instance of pmd : %s", - RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)); - } - } - - /* Create an ARMv8 device if required */ - if (gbl_driver_id == rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_ARMV8_PMD))) { - nb_devs = rte_cryptodev_device_count_by_driver( - rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_ARMV8_PMD))); - if (nb_devs < 1) { - ret = rte_vdev_init( - RTE_STR(CRYPTODEV_NAME_ARMV8_PMD), - NULL); - - TEST_ASSERT(ret == 0, "Failed to create " - "instance of pmd : %s", - RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)); - } - } - - nb_devs = rte_cryptodev_count(); - if (nb_devs < 1) { - RTE_LOG(ERR, USER1, "No crypto devices found?\n"); - return TEST_FAILED; - } - - /* Search for the first valid */ - for (i = 0; i < nb_devs; i++) { - rte_cryptodev_info_get(i, &info); - if (info.driver_id == (uint8_t) gbl_driver_id) { - ts_params->dev_id = i; - valid_dev_id = 1; - break; - } - } - - if (!valid_dev_id) - return TEST_FAILED; - - /* - * Using Crypto Device Id 0 by default. - * Set up all the qps on this device - */ - - rte_cryptodev_info_get(ts_params->dev_id, &info); - - ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs; - ts_params->conf.socket_id = SOCKET_ID_ANY; - - unsigned int session_size = sizeof(struct rte_cryptodev_sym_session) + - rte_cryptodev_get_private_session_size(ts_params->dev_id); - - ts_params->sess_mp = rte_mempool_create( - "test_sess_mp_perf", - info.sym.max_nb_sessions, - session_size, - 0, 0, NULL, NULL, NULL, - NULL, SOCKET_ID_ANY, - 0); - - TEST_ASSERT_NOT_NULL(ts_params->sess_mp, - "session mempool allocation failed"); - - TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->dev_id, - &ts_params->conf), - "Failed to configure cryptodev %u", - ts_params->dev_id); - - ts_params->qp_conf.nb_descriptors = PERF_NUM_OPS_INFLIGHT; - for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) { - - TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( - ts_params->dev_id, qp_id, - &ts_params->qp_conf, - rte_cryptodev_socket_id(ts_params->dev_id), - ts_params->sess_mp), - "Failed to setup queue pair %u on cryptodev %u", - qp_id, ts_params->dev_id); - } - - return TEST_SUCCESS; -} -static void -testsuite_teardown(void) -{ - struct crypto_testsuite_params *ts_params = - &testsuite_params; - - if (ts_params->mbuf_mp != NULL) - RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_MBUFPOOL count %u\n", - rte_mempool_avail_count(ts_params->mbuf_mp)); - if (ts_params->op_mpool != NULL) - RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_OP POOL count %u\n", - rte_mempool_avail_count(ts_params->op_mpool)); - /* Free session mempool */ - if (ts_params->sess_mp != NULL) { - rte_mempool_free(ts_params->sess_mp); - ts_params->sess_mp = NULL; - } - -} - -static int -ut_setup(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - - /* Clear unit test parameters before running test */ - memset(ut_params, 0, sizeof(*ut_params)); - - rte_cryptodev_stats_reset(ts_params->dev_id); - - /* Start the device */ - TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts_params->dev_id), - "Failed to start cryptodev %u", - ts_params->dev_id); - - return TEST_SUCCESS; -} - -static void -ut_teardown(void) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - struct rte_cryptodev_stats stats; - - unsigned i; - - /* free crypto session structure */ - if (ut_params->sess) { - rte_cryptodev_sym_session_clear(ts_params->dev_id, - ut_params->sess); - rte_cryptodev_sym_session_free(ut_params->sess); - } - - /* free crypto operation structure */ - if (ut_params->op) - rte_crypto_op_free(ut_params->op); - - for (i = 0; i < MAX_NUM_OF_OPS_PER_UT; i++) { - if (ut_params->obuf[i]) - rte_pktmbuf_free(ut_params->obuf[i]); - else if (ut_params->ibuf[i]) - rte_pktmbuf_free(ut_params->ibuf[i]); - } - - if (ts_params->mbuf_mp != NULL) - RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_MBUFPOOL count %u\n", - rte_mempool_avail_count(ts_params->mbuf_mp)); - - rte_cryptodev_stats_get(ts_params->dev_id, &stats); - - /* Stop the device */ - rte_cryptodev_stop(ts_params->dev_id); -} - -const char plaintext_quote[] = - "THE COUNT OF MONTE CRISTO by Alexandre Dumas, Pere Chapter 1. " - "Marseilles--The Arrival. On the 24th of February, 1815, the " - "look-out at Notre-Dame de la Garde signalled the three-master," - " the Pharaon from Smyrna, Trieste, and Naples. As usual, a " - "pilot put off immediately, and rounding the Chateau d'If, got " - "on board the vessel between Cape Morgion and Rion island. " - "Immediately, and according to custom, the ramparts of Fort " - "Saint-Jean were covered with spectators; it is always an event " - "at Marseilles for a ship to come into port, especially when " - "this ship, like the Pharaon, has been built, rigged, and laden" - " at the old Phocee docks, and belongs to an owner of the city." - " The ship drew on and had safely passed the strait, which some" - " volcanic shock has made between the Calasareigne and Jaros " - "islands; had doubled Pomegue, and approached the harbor under" - " topsails, jib, and spanker, but so slowly and sedately that" - " the idlers, with that instinct which is the forerunner of " - "evil, asked one another what misfortune could have happened " - "on board. However, those experienced in navigation saw plainly" - " that if any accident had occurred, it was not to the vessel " - "herself, for she bore down with all the evidence of being " - "skilfully handled, the anchor a-cockbill, the jib-boom guys " - "already eased off, and standing by the side of the pilot, who" - " was steering the Pharaon towards the narrow entrance of the" - " inner port, was a young man, who, with activity and vigilant" - " eye, watched every motion of the ship, and repeated each " - "direction of the pilot. The vague disquietude which prevailed " - "among the spectators had so much affected one of the crowd " - "that he did not await the arrival of the vessel in harbor, but" - " jumping into a small skiff, desired to be pulled alongside " - "the Pharaon, which he reached as she rounded into La Reserve " - "basin. When the young man on board saw this person approach, " - "he left his station by the pilot, and, hat in hand, leaned " - "over the ship's bulwarks. He was a fine, tall, slim young " - "fellow of eighteen or twenty, with black eyes, and hair as " - "dark as a raven's wing; and his whole appearance bespoke that " - "calmness and resolution peculiar to men accustomed from their " - "cradle to contend with danger. \"Ah, is it you, Dantes?\" " - "cried the man in the skiff. \"What's the matter? and why have " - "you such an air of sadness aboard?\" \"A great misfortune, M. " - "Morrel,\" replied the young man,--\"a great misfortune, for me" - " especially! Off Civita Vecchia we lost our brave Captain " - "Leclere.\" \"And the cargo?\" inquired the owner, eagerly. " - "\"Is all safe, M. Morrel; and I think you will be satisfied on" - " that head. But poor Captain Leclere--\" \"What happened to " - "him?\" asked the owner, with an air of considerable " - "resignation. \"What happened to the worthy captain?\" \"He " - "died.\" \"Fell into the sea?\" \"No, sir, he died of " - "brain-fever in dreadful agony.\" Then turning to the crew, " - "he said, \"Bear a hand there, to take in sail!\" All hands " - "obeyed, and at once the eight or ten seamen who composed the " - "crew, sprang to their respective stations at the spanker " - "brails and outhaul, topsail sheets and halyards, the jib " - "downhaul, and the topsail clewlines and buntlines. The young " - "sailor gave a look to see that his orders were promptly and " - "accurately obeyed, and then turned again to the owner. \"And " - "how did this misfortune occur?\" inquired the latter, resuming" - " the interrupted conversation. \"Alas, sir, in the most " - "unexpected manner. After a long talk with the harbor-master, " - "Captain Leclere left Naples greatly disturbed in mind. In " - "twenty-four hours he was attacked by a fever, and died three " - "days afterwards. We performed the usual burial service, and he" - " is at his rest, sewn up in his hammock with a thirty-six " - "pound shot at his head and his heels, off El Giglio island. " - "We bring to his widow his sword and cross of honor. It was " - "worth while, truly,\" added the young man with a melancholy " - "smile, \"to make war against the English for ten years, and " - "to die in his bed at last, like everybody else."; - -#define QUOTE_LEN_64B (64) -#define QUOTE_LEN_128B (128) -#define QUOTE_LEN_256B (256) -#define QUOTE_LEN_512B (512) -#define QUOTE_LEN_768B (768) -#define QUOTE_LEN_1024B (1024) -#define QUOTE_LEN_1280B (1280) -#define QUOTE_LEN_1536B (1536) -#define QUOTE_LEN_1792B (1792) -#define QUOTE_LEN_2048B (2048) - - -/* ***** AES-CBC / HMAC-SHA256 Performance Tests ***** */ - -#define HMAC_KEY_LENGTH_SHA256 (DIGEST_BYTE_LENGTH_SHA256) - -#define CIPHER_KEY_LENGTH_AES_CBC (16) -#define CIPHER_IV_LENGTH_AES_CBC (CIPHER_KEY_LENGTH_AES_CBC) - -static uint8_t aes_cbc_128_key[] = { - 0xE4, 0x23, 0x33, 0x8A, 0x35, 0x64, 0x61, 0xE2, - 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA }; - -static uint8_t aes_cbc_128_iv[] = { - 0xf5, 0xd3, 0x89, 0x0f, 0x47, 0x00, 0xcb, 0x52, - 0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1 }; - -static uint8_t hmac_sha256_key[] = { - 0xff, 0xcb, 0x37, 0x30, 0x1d, 0x4a, 0xc2, 0x41, - 0x49, 0x03, 0xDD, 0xC6, 0xB8, 0xCA, 0x55, 0x7A, - 0x58, 0x34, 0x85, 0x61, 0x1C, 0x42, 0x10, 0x76, - 0x9a, 0x4f, 0x88, 0x1b, 0xb6, 0x8f, 0xd8, 0x60 }; - - -/* Cipher text output */ - -static const uint8_t AES_CBC_ciphertext_64B[] = { - 0x05, 0x15, 0x77, 0x32, 0xc9, 0x66, 0x91, 0x50, - 0x93, 0x9f, 0xbb, 0x4e, 0x2e, 0x5a, 0x02, 0xd0, - 0x2d, 0x9d, 0x31, 0x5d, 0xc8, 0x9e, 0x86, 0x36, - 0x54, 0x5c, 0x50, 0xe8, 0x75, 0x54, 0x74, 0x5e, - 0xd5, 0xa2, 0x84, 0x21, 0x2d, 0xc5, 0xf8, 0x1c, - 0x55, 0x1a, 0xba, 0x91, 0xce, 0xb5, 0xa3, 0x1e, - 0x31, 0xbf, 0xe9, 0xa1, 0x97, 0x5c, 0x2b, 0xd6, - 0x57, 0xa5, 0x9f, 0xab, 0xbd, 0xb0, 0x9b, 0x9c -}; - -static const uint8_t AES_CBC_ciphertext_128B[] = { - 0x79, 0x92, 0x65, 0xc8, 0xfb, 0x0a, 0xc7, 0xc4, - 0x9b, 0x3b, 0xbe, 0x69, 0x7f, 0x7c, 0xf4, 0x4e, - 0xa5, 0x0d, 0xf6, 0x33, 0xc4, 0xdf, 0xf3, 0x0d, - 0xdb, 0xb9, 0x68, 0x34, 0xb0, 0x0d, 0xbd, 0xb9, - 0xa7, 0xf3, 0x86, 0x50, 0x2a, 0xbe, 0x50, 0x5d, - 0xb3, 0xbe, 0x72, 0xf9, 0x02, 0xb1, 0x69, 0x0b, - 0x8c, 0x96, 0x4c, 0x3c, 0x0c, 0x1e, 0x76, 0xe5, - 0x7e, 0x75, 0xdd, 0xd0, 0xa9, 0x75, 0x00, 0x13, - 0x6b, 0x1e, 0xc0, 0xad, 0xfc, 0x03, 0xb5, 0x99, - 0xdc, 0x37, 0x35, 0xfc, 0x16, 0x34, 0xfd, 0xb4, - 0xea, 0x1e, 0xb6, 0x51, 0xdf, 0xab, 0x87, 0xd6, - 0x87, 0x41, 0xfa, 0x1c, 0xc6, 0x78, 0xa6, 0x3c, - 0x1d, 0x76, 0xfe, 0xff, 0x65, 0xfc, 0x63, 0x1e, - 0x1f, 0xe2, 0x7c, 0x9b, 0xa2, 0x72, 0xc3, 0x34, - 0x23, 0xdf, 0x01, 0xf0, 0xfd, 0x02, 0x8b, 0x97, - 0x00, 0x2b, 0x97, 0x4e, 0xab, 0x98, 0x21, 0x3c -}; - -static const uint8_t AES_CBC_ciphertext_256B[] = { - 0xc7, 0x71, 0x2b, 0xed, 0x2c, 0x97, 0x59, 0xfa, - 0xcf, 0x5a, 0xb9, 0x31, 0x92, 0xe0, 0xc9, 0x92, - 0xc0, 0x2d, 0xd5, 0x9c, 0x84, 0xbf, 0x70, 0x36, - 0x13, 0x48, 0xe0, 0xb1, 0xbf, 0x6c, 0xcd, 0x91, - 0xa0, 0xc3, 0x57, 0x6c, 0x3f, 0x0e, 0x34, 0x41, - 0xe7, 0x9c, 0xc0, 0xec, 0x18, 0x0c, 0x05, 0x52, - 0x78, 0xe2, 0x3c, 0x6e, 0xdf, 0xa5, 0x49, 0xc7, - 0xf2, 0x55, 0x00, 0x8f, 0x65, 0x6d, 0x4b, 0xd0, - 0xcb, 0xd4, 0xd2, 0x0b, 0xea, 0xf4, 0xb0, 0x85, - 0x61, 0x9e, 0x36, 0xc0, 0x71, 0xb7, 0x80, 0xad, - 0x40, 0x78, 0xb4, 0x70, 0x2b, 0xe8, 0x80, 0xc5, - 0x19, 0x35, 0x96, 0x55, 0x3b, 0x40, 0x03, 0xbb, - 0x9f, 0xa6, 0xc2, 0x82, 0x92, 0x04, 0xc3, 0xa6, - 0x96, 0xc4, 0x7f, 0x4c, 0x3e, 0x3c, 0x79, 0x82, - 0x88, 0x8b, 0x3f, 0x8b, 0xc5, 0x9f, 0x44, 0xbe, - 0x71, 0xe7, 0x09, 0xa2, 0x40, 0xa2, 0x23, 0x4e, - 0x9f, 0x31, 0xab, 0x6f, 0xdf, 0x59, 0x40, 0xe1, - 0x12, 0x15, 0x55, 0x4b, 0xea, 0x3f, 0xa1, 0x41, - 0x4f, 0xaf, 0xcd, 0x27, 0x2a, 0x61, 0xa1, 0x9e, - 0x82, 0x30, 0x05, 0x05, 0x55, 0xce, 0x99, 0xd3, - 0x8f, 0x3f, 0x86, 0x79, 0xdc, 0x9f, 0x33, 0x07, - 0x75, 0x26, 0xc8, 0x72, 0x81, 0x0f, 0x9b, 0xf7, - 0xb1, 0xfb, 0xd3, 0x91, 0x36, 0x08, 0xab, 0x26, - 0x70, 0x53, 0x0c, 0x99, 0xfd, 0xa9, 0x07, 0xb4, - 0xe9, 0xce, 0xc1, 0xd6, 0xd2, 0x2c, 0x71, 0x80, - 0xec, 0x59, 0x61, 0x0b, 0x24, 0xf0, 0x6d, 0x33, - 0x73, 0x45, 0x6e, 0x80, 0x03, 0x45, 0xf2, 0x76, - 0xa5, 0x8a, 0xc9, 0xcf, 0xaf, 0x4a, 0xed, 0x35, - 0xc0, 0x97, 0x52, 0xc5, 0x00, 0xdf, 0xef, 0xc7, - 0x9f, 0xf2, 0xe8, 0x15, 0x3e, 0xb3, 0x30, 0xe7, - 0x00, 0xd0, 0x4e, 0xeb, 0x79, 0xf6, 0xf6, 0xcf, - 0xf0, 0xe7, 0x61, 0xd5, 0x3d, 0x6a, 0x73, 0x9d -}; - -static const uint8_t AES_CBC_ciphertext_512B[] = { - 0xb4, 0xc6, 0xc6, 0x5f, 0x7e, 0xca, 0x05, 0x70, - 0x21, 0x7b, 0x92, 0x9e, 0x23, 0xe7, 0x92, 0xb8, - 0x27, 0x3d, 0x20, 0x29, 0x57, 0xfa, 0x1f, 0x26, - 0x0a, 0x04, 0x34, 0xa6, 0xf2, 0xdc, 0x44, 0xb6, - 0x43, 0x40, 0x62, 0xde, 0x0c, 0xde, 0x1c, 0x30, - 0x43, 0x85, 0x0b, 0xe8, 0x93, 0x1f, 0xa1, 0x2a, - 0x8a, 0x27, 0x35, 0x39, 0x14, 0x9f, 0x37, 0x64, - 0x59, 0xb5, 0x0e, 0x96, 0x82, 0x5d, 0x63, 0x45, - 0xd6, 0x93, 0x89, 0x46, 0xe4, 0x71, 0x31, 0xeb, - 0x0e, 0xd1, 0x7b, 0xda, 0x90, 0xb5, 0x81, 0xac, - 0x76, 0x54, 0x54, 0x85, 0x0b, 0xa9, 0x46, 0x9c, - 0xf0, 0xfd, 0xde, 0x5d, 0xa8, 0xe3, 0xee, 0xe9, - 0xf4, 0x9d, 0x34, 0x76, 0x39, 0xe7, 0xc3, 0x4a, - 0x84, 0x38, 0x92, 0x61, 0xf1, 0x12, 0x9f, 0x05, - 0xda, 0xdb, 0xc1, 0xd4, 0xb0, 0xa0, 0x27, 0x19, - 0xa0, 0x56, 0x5d, 0x9b, 0xcc, 0x47, 0x7c, 0x15, - 0x1d, 0x52, 0x66, 0xd5, 0xff, 0xef, 0x12, 0x23, - 0x86, 0xe2, 0xee, 0x81, 0x2c, 0x3d, 0x7d, 0x28, - 0xd5, 0x42, 0xdf, 0xdb, 0x75, 0x1c, 0xeb, 0xdf, - 0x13, 0x23, 0xd5, 0x17, 0x89, 0xea, 0xd7, 0x01, - 0xff, 0x57, 0x6a, 0x44, 0x61, 0xf4, 0xea, 0xbe, - 0x97, 0x9b, 0xc2, 0xb1, 0x9c, 0x5d, 0xff, 0x4f, - 0x73, 0x2d, 0x3f, 0x57, 0x28, 0x38, 0xbf, 0x3d, - 0x9f, 0xda, 0x49, 0x55, 0x8f, 0xb2, 0x77, 0xec, - 0x0f, 0xbc, 0xce, 0xb8, 0xc6, 0xe1, 0x03, 0xed, - 0x35, 0x9c, 0xf2, 0x4d, 0xa4, 0x29, 0x6c, 0xd6, - 0x6e, 0x05, 0x53, 0x46, 0xc1, 0x41, 0x09, 0x36, - 0x0b, 0x7d, 0xf4, 0x9e, 0x0f, 0xba, 0x86, 0x33, - 0xdd, 0xf1, 0xa7, 0xf7, 0xd5, 0x29, 0xa8, 0xa7, - 0x4d, 0xce, 0x0c, 0xf5, 0xb4, 0x6c, 0xd8, 0x27, - 0xb0, 0x87, 0x2a, 0x6f, 0x7f, 0x3f, 0x8f, 0xc3, - 0xe2, 0x3e, 0x94, 0xcf, 0x61, 0x4a, 0x09, 0x3d, - 0xf9, 0x55, 0x19, 0x31, 0xf2, 0xd2, 0x4a, 0x3e, - 0xc1, 0xf5, 0xed, 0x7c, 0x45, 0xb0, 0x0c, 0x7b, - 0xdd, 0xa6, 0x0a, 0x26, 0x66, 0xec, 0x85, 0x49, - 0x00, 0x38, 0x05, 0x7c, 0x9c, 0x1c, 0x92, 0xf5, - 0xf7, 0xdb, 0x5d, 0xbd, 0x61, 0x0c, 0xc9, 0xaf, - 0xfd, 0x57, 0x3f, 0xee, 0x2b, 0xad, 0x73, 0xef, - 0xa3, 0xc1, 0x66, 0x26, 0x44, 0x5e, 0xf9, 0x12, - 0x86, 0x66, 0xa9, 0x61, 0x75, 0xa1, 0xbc, 0x40, - 0x7f, 0xa8, 0x08, 0x02, 0xc0, 0x76, 0x0e, 0x76, - 0xb3, 0x26, 0x3d, 0x1c, 0x40, 0x65, 0xe4, 0x18, - 0x0f, 0x62, 0x17, 0x8f, 0x1e, 0x61, 0xb8, 0x08, - 0x83, 0x54, 0x42, 0x11, 0x03, 0x30, 0x8e, 0xb7, - 0xc1, 0x9c, 0xec, 0x69, 0x52, 0x95, 0xfb, 0x7b, - 0x1a, 0x0c, 0x20, 0x24, 0xf7, 0xb8, 0x38, 0x0c, - 0xb8, 0x7b, 0xb6, 0x69, 0x70, 0xd0, 0x61, 0xb9, - 0x70, 0x06, 0xc2, 0x5b, 0x20, 0x47, 0xf7, 0xd9, - 0x32, 0xc2, 0xf2, 0x90, 0xb6, 0x4d, 0xcd, 0x3c, - 0x6d, 0x74, 0xea, 0x82, 0x35, 0x1b, 0x08, 0x44, - 0xba, 0xb7, 0x33, 0x82, 0x33, 0x27, 0x54, 0x77, - 0x6e, 0x58, 0xfe, 0x46, 0x5a, 0xb4, 0x88, 0x53, - 0x8d, 0x9b, 0xb1, 0xab, 0xdf, 0x04, 0xe1, 0xfb, - 0xd7, 0x1e, 0xd7, 0x38, 0x64, 0x54, 0xba, 0xb0, - 0x6c, 0x84, 0x7a, 0x0f, 0xa7, 0x80, 0x6b, 0x86, - 0xd9, 0xc9, 0xc6, 0x31, 0x95, 0xfa, 0x8a, 0x2c, - 0x14, 0xe1, 0x85, 0x66, 0x27, 0xfd, 0x63, 0x3e, - 0xf0, 0xfa, 0x81, 0xc9, 0x89, 0x4f, 0xe2, 0x6a, - 0x8c, 0x17, 0xb5, 0xc7, 0x9f, 0x5d, 0x3f, 0x6b, - 0x3f, 0xcd, 0x13, 0x7a, 0x3c, 0xe6, 0x4e, 0xfa, - 0x7a, 0x10, 0xb8, 0x7c, 0x40, 0xec, 0x93, 0x11, - 0x1f, 0xd0, 0x9e, 0xc3, 0x56, 0xb9, 0xf5, 0x21, - 0x18, 0x41, 0x31, 0xea, 0x01, 0x8d, 0xea, 0x1c, - 0x95, 0x5e, 0x56, 0x33, 0xbc, 0x7a, 0x3f, 0x6f -}; - -static const uint8_t AES_CBC_ciphertext_768B[] = { - 0x3e, 0x7f, 0x9e, 0x4c, 0x88, 0x15, 0x68, 0x69, - 0x10, 0x09, 0xe1, 0xa7, 0x0f, 0x27, 0x88, 0x2d, - 0x90, 0x73, 0x4f, 0x67, 0xd3, 0x8b, 0xaf, 0xa1, - 0x2c, 0x37, 0xa5, 0x6c, 0x7c, 0xbd, 0x95, 0x4c, - 0x82, 0xcf, 0x05, 0x49, 0x16, 0x5c, 0xe7, 0x06, - 0xd4, 0xcb, 0x55, 0x65, 0x9a, 0xd0, 0xe1, 0x46, - 0x3a, 0x37, 0x71, 0xad, 0xb0, 0xb4, 0x99, 0x1e, - 0x23, 0x57, 0x48, 0x96, 0x9c, 0xc5, 0xc4, 0xdb, - 0x64, 0x3e, 0xc9, 0x7f, 0x90, 0x5a, 0xa0, 0x08, - 0x75, 0x4c, 0x09, 0x06, 0x31, 0x6e, 0x59, 0x29, - 0xfc, 0x2f, 0x72, 0xde, 0xf2, 0x40, 0x5a, 0xfe, - 0xd3, 0x66, 0x64, 0xb8, 0x9c, 0xc9, 0xa6, 0x1f, - 0xc3, 0x52, 0xcd, 0xb5, 0xd1, 0x4f, 0x43, 0x3f, - 0xf4, 0x59, 0x25, 0xc4, 0xdd, 0x3e, 0x58, 0x7c, - 0x21, 0xd6, 0x21, 0xce, 0xa4, 0xbe, 0x08, 0x23, - 0x46, 0x68, 0xc0, 0x00, 0x91, 0x47, 0xca, 0x9b, - 0xe0, 0xb4, 0xe3, 0xab, 0xbf, 0xcf, 0x68, 0x26, - 0x97, 0x23, 0x09, 0x93, 0x64, 0x8f, 0x57, 0x59, - 0xe2, 0x41, 0x7c, 0xa2, 0x48, 0x7e, 0xd5, 0x2c, - 0x54, 0x09, 0x1b, 0x07, 0x94, 0xca, 0x39, 0x83, - 0xdd, 0xf4, 0x7a, 0x1d, 0x2d, 0xdd, 0x67, 0xf7, - 0x3c, 0x30, 0x89, 0x3e, 0xc1, 0xdc, 0x1d, 0x8f, - 0xfc, 0xb1, 0xe9, 0x13, 0x31, 0xb0, 0x16, 0xdb, - 0x88, 0xf2, 0x32, 0x7e, 0x73, 0xa3, 0xdf, 0x08, - 0x6b, 0x53, 0x92, 0x08, 0xc9, 0x9d, 0x98, 0xb2, - 0xf4, 0x8c, 0xb1, 0x95, 0xdc, 0xb6, 0xfc, 0xec, - 0xf1, 0xc9, 0x0d, 0x6d, 0x42, 0x2c, 0xf5, 0x38, - 0x29, 0xf4, 0xd8, 0x98, 0x0f, 0xb0, 0x81, 0xa5, - 0xaa, 0xe6, 0x1f, 0x6e, 0x87, 0x32, 0x1b, 0x02, - 0x07, 0x57, 0x38, 0x83, 0xf3, 0xe4, 0x54, 0x7c, - 0xa8, 0x43, 0xdf, 0x3f, 0x42, 0xfd, 0x67, 0x28, - 0x06, 0x4d, 0xea, 0xce, 0x1f, 0x84, 0x4a, 0xcd, - 0x8c, 0x61, 0x5e, 0x8f, 0x61, 0xed, 0x84, 0x03, - 0x53, 0x6a, 0x9e, 0xbf, 0x68, 0x83, 0xa7, 0x42, - 0x56, 0x57, 0xcd, 0x45, 0x29, 0xfc, 0x7b, 0x07, - 0xfc, 0xe9, 0xb9, 0x42, 0xfd, 0x29, 0xd5, 0xfd, - 0x98, 0x11, 0xd1, 0x8d, 0x67, 0x29, 0x47, 0x61, - 0xd8, 0x27, 0x37, 0x79, 0x29, 0xd1, 0x94, 0x6f, - 0x8d, 0xf3, 0x1b, 0x3d, 0x6a, 0xb1, 0x59, 0xef, - 0x1b, 0xd4, 0x70, 0x0e, 0xac, 0xab, 0xa0, 0x2b, - 0x1f, 0x5e, 0x04, 0xf0, 0x0e, 0x35, 0x72, 0x90, - 0xfc, 0xcf, 0x86, 0x43, 0xea, 0x45, 0x6d, 0x22, - 0x63, 0x06, 0x1a, 0x58, 0xd7, 0x2d, 0xc5, 0xb0, - 0x60, 0x69, 0xe8, 0x53, 0xc2, 0xa2, 0x57, 0x83, - 0xc4, 0x31, 0xb4, 0xc6, 0xb3, 0xa1, 0x77, 0xb3, - 0x1c, 0xca, 0x89, 0x3f, 0xf5, 0x10, 0x3b, 0x36, - 0x31, 0x7d, 0x00, 0x46, 0x00, 0x92, 0xa0, 0xa0, - 0x34, 0xd8, 0x5e, 0x62, 0xa9, 0xe0, 0x23, 0x37, - 0x50, 0x85, 0xc7, 0x3a, 0x20, 0xa3, 0x98, 0xc0, - 0xac, 0x20, 0x06, 0x0f, 0x17, 0x3c, 0xfc, 0x43, - 0x8c, 0x9d, 0xec, 0xf5, 0x9a, 0x35, 0x96, 0xf7, - 0xb7, 0x4c, 0xf9, 0x69, 0xf8, 0xd4, 0x1e, 0x9e, - 0xf9, 0x7c, 0xc4, 0xd2, 0x11, 0x14, 0x41, 0xb9, - 0x89, 0xd6, 0x07, 0xd2, 0x37, 0x07, 0x5e, 0x5e, - 0xae, 0x60, 0xdc, 0xe4, 0xeb, 0x38, 0x48, 0x6d, - 0x95, 0x8d, 0x71, 0xf2, 0xba, 0xda, 0x5f, 0x08, - 0x9d, 0x4a, 0x0f, 0x56, 0x90, 0x64, 0xab, 0xb6, - 0x88, 0x22, 0xa8, 0x90, 0x1f, 0x76, 0x2c, 0x83, - 0x43, 0xce, 0x32, 0x55, 0x45, 0x84, 0x57, 0x43, - 0xf9, 0xa8, 0xd1, 0x4f, 0xe3, 0xc1, 0x72, 0x9c, - 0xeb, 0x64, 0xf7, 0xe4, 0x61, 0x2b, 0x93, 0xd1, - 0x1f, 0xbb, 0x5c, 0xff, 0xa1, 0x59, 0x69, 0xcf, - 0xf7, 0xaf, 0x58, 0x45, 0xd5, 0x3e, 0x98, 0x7d, - 0x26, 0x39, 0x5c, 0x75, 0x3c, 0x4a, 0xbf, 0x5e, - 0x12, 0x10, 0xb0, 0x93, 0x0f, 0x86, 0x82, 0xcf, - 0xb2, 0xec, 0x70, 0x5c, 0x0b, 0xad, 0x5d, 0x63, - 0x65, 0x32, 0xa6, 0x04, 0x58, 0x03, 0x91, 0x2b, - 0xdb, 0x8f, 0xd3, 0xa3, 0x2b, 0x3a, 0xf5, 0xa1, - 0x62, 0x6c, 0xb6, 0xf0, 0x13, 0x3b, 0x8c, 0x07, - 0x10, 0x82, 0xc9, 0x56, 0x24, 0x87, 0xfc, 0x56, - 0xe8, 0xef, 0x90, 0x8b, 0xd6, 0x48, 0xda, 0x53, - 0x04, 0x49, 0x41, 0xa4, 0x67, 0xe0, 0x33, 0x24, - 0x6b, 0x9c, 0x07, 0x55, 0x4c, 0x5d, 0xe9, 0x35, - 0xfa, 0xbd, 0xea, 0xa8, 0x3f, 0xe9, 0xf5, 0x20, - 0x5c, 0x60, 0x0f, 0x0d, 0x24, 0xcb, 0x1a, 0xd6, - 0xe8, 0x5c, 0xa8, 0x42, 0xae, 0xd0, 0xd2, 0xf2, - 0xa8, 0xbe, 0xea, 0x0f, 0x8d, 0xfb, 0x81, 0xa3, - 0xa4, 0xef, 0xb7, 0x3e, 0x91, 0xbd, 0x26, 0x0f, - 0x8e, 0xf1, 0xb2, 0xa5, 0x47, 0x06, 0xfa, 0x40, - 0x8b, 0x31, 0x7a, 0x5a, 0x74, 0x2a, 0x0a, 0x7c, - 0x62, 0x5d, 0x39, 0xa4, 0xae, 0x14, 0x85, 0x08, - 0x5b, 0x20, 0x85, 0xf1, 0x57, 0x6e, 0x71, 0x13, - 0x4e, 0x2b, 0x49, 0x87, 0x01, 0xdf, 0x37, 0xed, - 0x28, 0xee, 0x4d, 0xa1, 0xf4, 0xb3, 0x3b, 0xba, - 0x2d, 0xb3, 0x46, 0x17, 0x84, 0x80, 0x9d, 0xd7, - 0x93, 0x1f, 0x28, 0x7c, 0xf5, 0xf9, 0xd6, 0x85, - 0x8c, 0xa5, 0x44, 0xe9, 0x2c, 0x65, 0x51, 0x5f, - 0x53, 0x7a, 0x09, 0xd9, 0x30, 0x16, 0x95, 0x89, - 0x9c, 0x0b, 0xef, 0x90, 0x6d, 0x23, 0xd3, 0x48, - 0x57, 0x3b, 0x55, 0x69, 0x96, 0xfc, 0xf7, 0x52, - 0x92, 0x38, 0x36, 0xbf, 0xa9, 0x0a, 0xbb, 0x68, - 0x45, 0x08, 0x25, 0xee, 0x59, 0xfe, 0xee, 0xf2, - 0x2c, 0xd4, 0x5f, 0x78, 0x59, 0x0d, 0x90, 0xf1, - 0xd7, 0xe4, 0x39, 0x0e, 0x46, 0x36, 0xf5, 0x75, - 0x03, 0x3c, 0x28, 0xfb, 0xfa, 0x8f, 0xef, 0xc9, - 0x61, 0x00, 0x94, 0xc3, 0xd2, 0x0f, 0xd9, 0xda -}; - -static const uint8_t AES_CBC_ciphertext_1024B[] = { - 0x7d, 0x01, 0x7e, 0x2f, 0x92, 0xb3, 0xea, 0x72, - 0x4a, 0x3f, 0x10, 0xf9, 0x2b, 0xb0, 0xd5, 0xb9, - 0x19, 0x68, 0x94, 0xe9, 0x93, 0xe9, 0xd5, 0x26, - 0x20, 0x44, 0xe2, 0x47, 0x15, 0x8d, 0x75, 0x48, - 0x8e, 0xe4, 0x40, 0x81, 0xb5, 0x06, 0xa8, 0xb8, - 0x0e, 0x0f, 0x3b, 0xbc, 0x5b, 0xbe, 0x3b, 0xa2, - 0x2a, 0x0c, 0x48, 0x98, 0x19, 0xdf, 0xe9, 0x25, - 0x75, 0xab, 0x93, 0x44, 0xb1, 0x72, 0x70, 0xbb, - 0x20, 0xcf, 0x78, 0xe9, 0x4d, 0xc6, 0xa9, 0xa9, - 0x84, 0x78, 0xc5, 0xc0, 0xc4, 0xc9, 0x79, 0x1a, - 0xbc, 0x61, 0x25, 0x5f, 0xac, 0x01, 0x03, 0xb7, - 0xef, 0x07, 0xf2, 0x62, 0x98, 0xee, 0xe3, 0xad, - 0x94, 0x75, 0x30, 0x67, 0xb9, 0x15, 0x00, 0xe7, - 0x11, 0x32, 0x2e, 0x6b, 0x55, 0x9f, 0xac, 0x68, - 0xde, 0x61, 0x05, 0x80, 0x01, 0xf3, 0xad, 0xab, - 0xaf, 0x45, 0xe0, 0xf4, 0x68, 0x5c, 0xc0, 0x52, - 0x92, 0xc8, 0x21, 0xb6, 0xf5, 0x8a, 0x1d, 0xbb, - 0xfc, 0x4a, 0x11, 0x62, 0xa2, 0xc4, 0xf1, 0x2d, - 0x0e, 0xb2, 0xc7, 0x17, 0x34, 0xb4, 0x2a, 0x54, - 0x81, 0xc2, 0x1e, 0xcf, 0x51, 0x0a, 0x76, 0x54, - 0xf1, 0x48, 0x0d, 0x5c, 0xcd, 0x38, 0x3e, 0x38, - 0x3e, 0xf8, 0x46, 0x1d, 0x00, 0xf5, 0x62, 0xe1, - 0x5c, 0xb7, 0x8d, 0xce, 0xd0, 0x3f, 0xbb, 0x22, - 0xf1, 0xe5, 0xb1, 0xa0, 0x58, 0x5e, 0x3c, 0x0f, - 0x15, 0xd1, 0xac, 0x3e, 0xc7, 0x72, 0xc4, 0xde, - 0x8b, 0x95, 0x3e, 0x91, 0xf7, 0x1d, 0x04, 0x9a, - 0xc8, 0xe4, 0xbf, 0xd3, 0x22, 0xca, 0x4a, 0xdc, - 0xb6, 0x16, 0x79, 0x81, 0x75, 0x2f, 0x6b, 0xa7, - 0x04, 0x98, 0xa7, 0x4e, 0xc1, 0x19, 0x90, 0x33, - 0x33, 0x3c, 0x7f, 0xdd, 0xac, 0x09, 0x0c, 0xc3, - 0x91, 0x34, 0x74, 0xab, 0xa5, 0x35, 0x0a, 0x13, - 0xc3, 0x56, 0x67, 0x6d, 0x1a, 0x3e, 0xbf, 0x56, - 0x06, 0x67, 0x15, 0x5f, 0xfc, 0x8b, 0xa2, 0x3c, - 0x5e, 0xaf, 0x56, 0x1f, 0xe3, 0x2e, 0x9d, 0x0a, - 0xf9, 0x9b, 0xc7, 0xb5, 0x03, 0x1c, 0x68, 0x99, - 0xfa, 0x3c, 0x37, 0x59, 0xc1, 0xf7, 0x6a, 0x83, - 0x22, 0xee, 0xca, 0x7f, 0x7d, 0x49, 0xe6, 0x48, - 0x84, 0x54, 0x7a, 0xff, 0xb3, 0x72, 0x21, 0xd8, - 0x7a, 0x5d, 0xb1, 0x4b, 0xcc, 0x01, 0x6f, 0x90, - 0xc6, 0x68, 0x1c, 0x2c, 0xa1, 0xe2, 0x74, 0x40, - 0x26, 0x9b, 0x57, 0x53, 0xa3, 0x7c, 0x0b, 0x0d, - 0xcf, 0x05, 0x5d, 0x62, 0x4f, 0x75, 0x06, 0x62, - 0x1f, 0x26, 0x32, 0xaa, 0x25, 0xcc, 0x26, 0x8d, - 0xae, 0x01, 0x47, 0xa3, 0x00, 0x42, 0xe2, 0x4c, - 0xee, 0x29, 0xa2, 0x81, 0xa0, 0xfd, 0xeb, 0xff, - 0x9a, 0x66, 0x6e, 0x47, 0x5b, 0xab, 0x93, 0x5a, - 0x02, 0x6d, 0x6f, 0xf2, 0x6e, 0x02, 0x9d, 0xb1, - 0xab, 0x56, 0xdc, 0x8b, 0x9b, 0x17, 0xa8, 0xfb, - 0x87, 0x42, 0x7c, 0x91, 0x1e, 0x14, 0xc6, 0x6f, - 0xdc, 0xf0, 0x27, 0x30, 0xfa, 0x3f, 0xc4, 0xad, - 0x57, 0x85, 0xd2, 0xc9, 0x32, 0x2c, 0x13, 0xa6, - 0x04, 0x04, 0x50, 0x05, 0x2f, 0x72, 0xd9, 0x44, - 0x55, 0x6e, 0x93, 0x40, 0xed, 0x7e, 0xd4, 0x40, - 0x3e, 0x88, 0x3b, 0x8b, 0xb6, 0xeb, 0xc6, 0x5d, - 0x9c, 0x99, 0xa1, 0xcf, 0x30, 0xb2, 0xdc, 0x48, - 0x8a, 0x01, 0xa7, 0x61, 0x77, 0x50, 0x14, 0xf3, - 0x0c, 0x49, 0x53, 0xb3, 0xb4, 0xb4, 0x28, 0x41, - 0x4a, 0x2d, 0xd2, 0x4d, 0x2a, 0x30, 0x31, 0x83, - 0x03, 0x5e, 0xaa, 0xd3, 0xa3, 0xd1, 0xa1, 0xca, - 0x62, 0xf0, 0xe1, 0xf2, 0xff, 0xf0, 0x19, 0xa6, - 0xde, 0x22, 0x47, 0xb5, 0x28, 0x7d, 0xf7, 0x07, - 0x16, 0x0d, 0xb1, 0x55, 0x81, 0x95, 0xe5, 0x1d, - 0x4d, 0x78, 0xa9, 0x3e, 0xce, 0xe3, 0x1c, 0xf9, - 0x47, 0xc8, 0xec, 0xc5, 0xc5, 0x93, 0x4c, 0x34, - 0x20, 0x6b, 0xee, 0x9a, 0xe6, 0x86, 0x57, 0x58, - 0xd5, 0x58, 0xf1, 0x33, 0x10, 0x29, 0x9e, 0x93, - 0x2f, 0xf5, 0x90, 0x00, 0x17, 0x67, 0x4f, 0x39, - 0x18, 0xe1, 0xcf, 0x55, 0x78, 0xbb, 0xe6, 0x29, - 0x3e, 0x77, 0xd5, 0x48, 0xb7, 0x42, 0x72, 0x53, - 0x27, 0xfa, 0x5b, 0xe0, 0x36, 0x14, 0x97, 0xb8, - 0x9b, 0x3c, 0x09, 0x77, 0xc1, 0x0a, 0xe4, 0xa2, - 0x63, 0xfc, 0xbe, 0x5c, 0x17, 0xcf, 0x01, 0xf5, - 0x03, 0x0f, 0x17, 0xbc, 0x93, 0xdd, 0x5f, 0xe2, - 0xf3, 0x08, 0xa8, 0xb1, 0x85, 0xb6, 0x34, 0x3f, - 0x87, 0x42, 0xa5, 0x42, 0x3b, 0x0e, 0xd6, 0x83, - 0x6a, 0xfd, 0x5d, 0xc9, 0x67, 0xd5, 0x51, 0xc9, - 0x2a, 0x4e, 0x91, 0xb0, 0x59, 0xb2, 0x0f, 0xa2, - 0xe6, 0x47, 0x73, 0xc2, 0xa2, 0xae, 0xbb, 0xc8, - 0x42, 0xa3, 0x2a, 0x27, 0x29, 0x48, 0x8c, 0x54, - 0x6c, 0xec, 0x00, 0x2a, 0x42, 0xa3, 0x7a, 0x0f, - 0x12, 0x66, 0x6b, 0x96, 0xf6, 0xd0, 0x56, 0x4f, - 0x49, 0x5c, 0x47, 0xec, 0x05, 0x62, 0x54, 0xb2, - 0x64, 0x5a, 0x69, 0x1f, 0x19, 0xb4, 0x84, 0x5c, - 0xbe, 0x48, 0x8e, 0xfc, 0x58, 0x21, 0xce, 0xfa, - 0xaa, 0x84, 0xd2, 0xc1, 0x08, 0xb3, 0x87, 0x0f, - 0x4f, 0xa3, 0x3a, 0xb6, 0x44, 0xbe, 0x2e, 0x9a, - 0xdd, 0xb5, 0x44, 0x80, 0xca, 0xf4, 0xc3, 0x6e, - 0xba, 0x93, 0x77, 0xe0, 0x53, 0xfb, 0x37, 0xfb, - 0x88, 0xc3, 0x1f, 0x25, 0xde, 0x3e, 0x11, 0xf4, - 0x89, 0xe7, 0xd1, 0x3b, 0xb4, 0x23, 0xcb, 0x70, - 0xba, 0x35, 0x97, 0x7c, 0xbe, 0x84, 0x13, 0xcf, - 0xe0, 0x4d, 0x33, 0x91, 0x71, 0x85, 0xbb, 0x4b, - 0x97, 0x32, 0x5d, 0xa0, 0xb9, 0x8f, 0xdc, 0x27, - 0x5a, 0xeb, 0x71, 0xf1, 0xd5, 0x0d, 0x65, 0xb4, - 0x22, 0x81, 0xde, 0xa7, 0x58, 0x20, 0x0b, 0x18, - 0x11, 0x76, 0x5c, 0xe6, 0x6a, 0x2c, 0x99, 0x69, - 0xdc, 0xed, 0x67, 0x08, 0x5d, 0x5e, 0xe9, 0x1e, - 0x55, 0x70, 0xc1, 0x5a, 0x76, 0x1b, 0x8d, 0x2e, - 0x0d, 0xf9, 0xcc, 0x30, 0x8c, 0x44, 0x0f, 0x63, - 0x8c, 0x42, 0x8a, 0x9f, 0x4c, 0xd1, 0x48, 0x28, - 0x8a, 0xf5, 0x56, 0x2e, 0x23, 0x12, 0xfe, 0x67, - 0x9a, 0x13, 0x65, 0x75, 0x83, 0xf1, 0x3c, 0x98, - 0x07, 0x6b, 0xb7, 0x27, 0x5b, 0xf0, 0x70, 0xda, - 0x30, 0xf8, 0x74, 0x4e, 0x7a, 0x32, 0x84, 0xcc, - 0x0e, 0xcd, 0x80, 0x8b, 0x82, 0x31, 0x9a, 0x48, - 0xcf, 0x75, 0x00, 0x1f, 0x4f, 0xe0, 0x8e, 0xa3, - 0x6a, 0x2c, 0xd4, 0x73, 0x4c, 0x63, 0x7c, 0xa6, - 0x4d, 0x5e, 0xfd, 0x43, 0x3b, 0x27, 0xe1, 0x5e, - 0xa3, 0xa9, 0x5c, 0x3b, 0x60, 0xdd, 0xc6, 0x8d, - 0x5a, 0xf1, 0x3e, 0x89, 0x4b, 0x24, 0xcf, 0x01, - 0x3a, 0x2d, 0x44, 0xe7, 0xda, 0xe7, 0xa1, 0xac, - 0x11, 0x05, 0x0c, 0xa9, 0x7a, 0x82, 0x8c, 0x5c, - 0x29, 0x68, 0x9c, 0x73, 0x13, 0xcc, 0x67, 0x32, - 0x11, 0x5e, 0xe5, 0xcc, 0x8c, 0xf5, 0xa7, 0x52, - 0x83, 0x9a, 0x70, 0xef, 0xde, 0x55, 0x9c, 0xc7, - 0x8a, 0xed, 0xad, 0x28, 0x4a, 0xc5, 0x92, 0x6d, - 0x8e, 0x47, 0xca, 0xe3, 0xf8, 0x77, 0xb5, 0x26, - 0x64, 0x84, 0xc2, 0xf1, 0xd7, 0xae, 0x0c, 0xb9, - 0x39, 0x0f, 0x43, 0x6b, 0xe9, 0xe0, 0x09, 0x4b, - 0xe5, 0xe3, 0x17, 0xa6, 0x68, 0x69, 0x46, 0xf4, - 0xf0, 0x68, 0x7f, 0x2f, 0x1c, 0x7e, 0x4c, 0xd2, - 0xb5, 0xc6, 0x16, 0x85, 0xcf, 0x02, 0x4c, 0x89, - 0x0b, 0x25, 0xb0, 0xeb, 0xf3, 0x77, 0x08, 0x6a, - 0x46, 0x5c, 0xf6, 0x2f, 0xf1, 0x24, 0xc3, 0x4d, - 0x80, 0x60, 0x4d, 0x69, 0x98, 0xde, 0xc7, 0xa1, - 0xf6, 0x4e, 0x18, 0x0c, 0x2a, 0xb0, 0xb2, 0xe0, - 0x46, 0xe7, 0x49, 0x37, 0xc8, 0x5a, 0x23, 0x24, - 0xe3, 0x0f, 0xcc, 0x92, 0xb4, 0x8d, 0xdc, 0x9e -}; - -static const uint8_t AES_CBC_ciphertext_1280B[] = { - 0x91, 0x99, 0x5e, 0x9e, 0x84, 0xff, 0x59, 0x45, - 0xc1, 0xf4, 0xbc, 0x9c, 0xb9, 0x30, 0x6c, 0x51, - 0x73, 0x52, 0xb4, 0x44, 0x09, 0x79, 0xe2, 0x89, - 0x75, 0xeb, 0x54, 0x26, 0xce, 0xd8, 0x24, 0x98, - 0xaa, 0xf8, 0x13, 0x16, 0x68, 0x58, 0xc4, 0x82, - 0x0e, 0x31, 0xd3, 0x6a, 0x13, 0x58, 0x31, 0xe9, - 0x3a, 0xc1, 0x8b, 0xc5, 0x3f, 0x50, 0x42, 0xd1, - 0x93, 0xe4, 0x9b, 0x65, 0x2b, 0xf4, 0x1d, 0x9e, - 0x2d, 0xdb, 0x48, 0xef, 0x9a, 0x01, 0x68, 0xb6, - 0xea, 0x7a, 0x2b, 0xad, 0xfe, 0x77, 0x44, 0x7e, - 0x5a, 0xc5, 0x64, 0xb4, 0xfe, 0x5c, 0x80, 0xf3, - 0x20, 0x7e, 0xaf, 0x5b, 0xf8, 0xd1, 0x38, 0xa0, - 0x8d, 0x09, 0x77, 0x06, 0xfe, 0xf5, 0xf4, 0xe4, - 0xee, 0xb8, 0x95, 0x27, 0xed, 0x07, 0xb8, 0xaa, - 0x25, 0xb4, 0xe1, 0x4c, 0xeb, 0x3f, 0xdb, 0x39, - 0x66, 0x28, 0x1b, 0x60, 0x42, 0x8b, 0x99, 0xd9, - 0x49, 0xd6, 0x8c, 0xa4, 0x9d, 0xd8, 0x93, 0x58, - 0x8f, 0xfa, 0xd3, 0xf7, 0x37, 0x9c, 0x88, 0xab, - 0x16, 0x50, 0xfe, 0x01, 0x1f, 0x88, 0x48, 0xbe, - 0x21, 0xa9, 0x90, 0x9e, 0x73, 0xe9, 0x82, 0xf7, - 0xbf, 0x4b, 0x43, 0xf4, 0xbf, 0x22, 0x3c, 0x45, - 0x47, 0x95, 0x5b, 0x49, 0x71, 0x07, 0x1c, 0x8b, - 0x49, 0xa4, 0xa3, 0x49, 0xc4, 0x5f, 0xb1, 0xf5, - 0xe3, 0x6b, 0xf1, 0xdc, 0xea, 0x92, 0x7b, 0x29, - 0x40, 0xc9, 0x39, 0x5f, 0xdb, 0xbd, 0xf3, 0x6a, - 0x09, 0x9b, 0x2a, 0x5e, 0xc7, 0x0b, 0x25, 0x94, - 0x55, 0x71, 0x9c, 0x7e, 0x0e, 0xb4, 0x08, 0x12, - 0x8c, 0x6e, 0x77, 0xb8, 0x29, 0xf1, 0xc6, 0x71, - 0x04, 0x40, 0x77, 0x18, 0x3f, 0x01, 0x09, 0x9c, - 0x23, 0x2b, 0x5d, 0x2a, 0x88, 0x20, 0x23, 0x59, - 0x74, 0x2a, 0x67, 0x8f, 0xb7, 0xba, 0x38, 0x9f, - 0x0f, 0xcf, 0x94, 0xdf, 0xe1, 0x8f, 0x35, 0x5e, - 0x34, 0x0c, 0x32, 0x92, 0x2b, 0x23, 0x81, 0xf4, - 0x73, 0xa0, 0x5a, 0x2a, 0xbd, 0xa6, 0x6b, 0xae, - 0x43, 0xe2, 0xdc, 0x01, 0xc1, 0xc6, 0xc3, 0x04, - 0x06, 0xbb, 0xb0, 0x89, 0xb3, 0x4e, 0xbd, 0x81, - 0x1b, 0x03, 0x63, 0x93, 0xed, 0x4e, 0xf6, 0xe5, - 0x94, 0x6f, 0xd6, 0xf3, 0x20, 0xf3, 0xbc, 0x30, - 0xc5, 0xd6, 0xbe, 0x1c, 0x05, 0x34, 0x26, 0x4d, - 0x46, 0x5e, 0x56, 0x63, 0xfb, 0xdb, 0xcd, 0xed, - 0xb0, 0x7f, 0x83, 0x94, 0x55, 0x54, 0x2f, 0xab, - 0xc9, 0xb7, 0x16, 0x4f, 0x9e, 0x93, 0x25, 0xd7, - 0x9f, 0x39, 0x2b, 0x63, 0xcf, 0x1e, 0xa3, 0x0e, - 0x28, 0x47, 0x8a, 0x5f, 0x40, 0x02, 0x89, 0x1f, - 0x83, 0xe7, 0x87, 0xd1, 0x90, 0x17, 0xb8, 0x27, - 0x64, 0xe1, 0xe1, 0x48, 0x5a, 0x55, 0x74, 0x99, - 0x27, 0x9d, 0x05, 0x67, 0xda, 0x70, 0x12, 0x8f, - 0x94, 0x96, 0xfd, 0x36, 0xa4, 0x1d, 0x22, 0xe5, - 0x0b, 0xe5, 0x2f, 0x38, 0x55, 0xa3, 0x5d, 0x0b, - 0xcf, 0xd4, 0xa9, 0xb8, 0xd6, 0x9a, 0x16, 0x2e, - 0x6c, 0x4a, 0x25, 0x51, 0x7a, 0x09, 0x48, 0xdd, - 0xf0, 0xa3, 0x5b, 0x08, 0x1e, 0x2f, 0x03, 0x91, - 0x80, 0xe8, 0x0f, 0xe9, 0x5a, 0x2f, 0x90, 0xd3, - 0x64, 0xed, 0xd7, 0x51, 0x17, 0x66, 0x53, 0x40, - 0x43, 0x74, 0xef, 0x0a, 0x0d, 0x49, 0x41, 0xf2, - 0x67, 0x6e, 0xea, 0x14, 0xc8, 0x74, 0xd6, 0xa9, - 0xb9, 0x6a, 0xe3, 0xec, 0x7d, 0xe8, 0x6a, 0x21, - 0x3a, 0x52, 0x42, 0xfe, 0x9a, 0x15, 0x6d, 0x60, - 0x64, 0x88, 0xc5, 0xb2, 0x8b, 0x15, 0x2c, 0xff, - 0xe2, 0x35, 0xc3, 0xee, 0x9f, 0xcd, 0x82, 0xd9, - 0x14, 0x35, 0x2a, 0xb7, 0xf5, 0x2f, 0x7b, 0xbc, - 0x01, 0xfd, 0xa8, 0xe0, 0x21, 0x4e, 0x73, 0xf9, - 0xf2, 0xb0, 0x79, 0xc9, 0x10, 0x52, 0x8f, 0xa8, - 0x3e, 0x3b, 0xbe, 0xc5, 0xde, 0xf6, 0x53, 0xe3, - 0x1c, 0x25, 0x3a, 0x1f, 0x13, 0xbf, 0x13, 0xbb, - 0x94, 0xc2, 0x97, 0x43, 0x64, 0x47, 0x8f, 0x76, - 0xd7, 0xaa, 0xeb, 0xa4, 0x03, 0x50, 0x0c, 0x10, - 0x50, 0xd8, 0xf7, 0x75, 0x52, 0x42, 0xe2, 0x94, - 0x67, 0xf4, 0x60, 0xfb, 0x21, 0x9b, 0x7a, 0x05, - 0x50, 0x7c, 0x1b, 0x4a, 0x8b, 0x29, 0xe1, 0xac, - 0xd7, 0x99, 0xfd, 0x0d, 0x65, 0x92, 0xcd, 0x23, - 0xa7, 0x35, 0x8e, 0x13, 0xf2, 0xe4, 0x10, 0x74, - 0xc6, 0x4f, 0x19, 0xf7, 0x01, 0x0b, 0x46, 0xab, - 0xef, 0x8d, 0x4a, 0x4a, 0xfa, 0xda, 0xf3, 0xfb, - 0x40, 0x28, 0x88, 0xa2, 0x65, 0x98, 0x4d, 0x88, - 0xc7, 0xbf, 0x00, 0xc8, 0xd0, 0x91, 0xcb, 0x89, - 0x2f, 0xb0, 0x85, 0xfc, 0xa1, 0xc1, 0x9e, 0x83, - 0x88, 0xad, 0x95, 0xc0, 0x31, 0xa0, 0xad, 0xa2, - 0x42, 0xb5, 0xe7, 0x55, 0xd4, 0x93, 0x5a, 0x74, - 0x4e, 0x41, 0xc3, 0xcf, 0x96, 0x83, 0x46, 0xa1, - 0xb7, 0x5b, 0xb1, 0x34, 0x67, 0x4e, 0xb1, 0xd7, - 0x40, 0x20, 0x72, 0xe9, 0xc8, 0x74, 0xb7, 0xde, - 0x72, 0x29, 0x77, 0x4c, 0x74, 0x7e, 0xcc, 0x18, - 0xa5, 0x8d, 0x79, 0x8c, 0xd6, 0x6e, 0xcb, 0xd9, - 0xe1, 0x61, 0xe7, 0x36, 0xbc, 0x37, 0xea, 0xee, - 0xd8, 0x3c, 0x5e, 0x7c, 0x47, 0x50, 0xd5, 0xec, - 0x37, 0xc5, 0x63, 0xc3, 0xc9, 0x99, 0x23, 0x9f, - 0x64, 0x39, 0xdf, 0x13, 0x96, 0x6d, 0xea, 0x08, - 0x0c, 0x27, 0x2d, 0xfe, 0x0f, 0xc2, 0xa3, 0x97, - 0x04, 0x12, 0x66, 0x0d, 0x94, 0xbf, 0xbe, 0x3e, - 0xb9, 0xcf, 0x8e, 0xc1, 0x9d, 0xb1, 0x64, 0x17, - 0x54, 0x92, 0x3f, 0x0a, 0x51, 0xc8, 0xf5, 0x82, - 0x98, 0x73, 0x03, 0xc0, 0x5a, 0x51, 0x01, 0x67, - 0xb4, 0x01, 0x04, 0x06, 0xbc, 0x37, 0xde, 0x96, - 0x23, 0x3c, 0xce, 0x98, 0x3f, 0xd6, 0x51, 0x1b, - 0x01, 0x83, 0x0a, 0x1c, 0xf9, 0xeb, 0x7e, 0x72, - 0xa9, 0x51, 0x23, 0xc8, 0xd7, 0x2f, 0x12, 0xbc, - 0x08, 0xac, 0x07, 0xe7, 0xa7, 0xe6, 0x46, 0xae, - 0x54, 0xa3, 0xc2, 0xf2, 0x05, 0x2d, 0x06, 0x5e, - 0xfc, 0xe2, 0xa2, 0x23, 0xac, 0x86, 0xf2, 0x54, - 0x83, 0x4a, 0xb6, 0x48, 0x93, 0xa1, 0x78, 0xc2, - 0x07, 0xec, 0x82, 0xf0, 0x74, 0xa9, 0x18, 0xe9, - 0x53, 0x44, 0x49, 0xc2, 0x94, 0xf8, 0x94, 0x92, - 0x08, 0x3f, 0xbf, 0xa6, 0xe5, 0xc6, 0x03, 0x8a, - 0xc6, 0x90, 0x48, 0x6c, 0xee, 0xbd, 0x44, 0x92, - 0x1f, 0x2a, 0xce, 0x1d, 0xb8, 0x31, 0xa2, 0x9d, - 0x24, 0x93, 0xa8, 0x9f, 0x36, 0x00, 0x04, 0x7b, - 0xcb, 0x93, 0x59, 0xa1, 0x53, 0xdb, 0x13, 0x7a, - 0x54, 0xb1, 0x04, 0xdb, 0xce, 0x48, 0x4f, 0xe5, - 0x2f, 0xcb, 0xdf, 0x8f, 0x50, 0x7c, 0xfc, 0x76, - 0x80, 0xb4, 0xdc, 0x3b, 0xc8, 0x98, 0x95, 0xf5, - 0x50, 0xba, 0x70, 0x5a, 0x97, 0xd5, 0xfc, 0x98, - 0x4d, 0xf3, 0x61, 0x0f, 0xcf, 0xac, 0x49, 0x0a, - 0xdb, 0xc1, 0x42, 0x8f, 0xb6, 0x29, 0xd5, 0x65, - 0xef, 0x83, 0xf1, 0x30, 0x4b, 0x84, 0xd0, 0x69, - 0xde, 0xd2, 0x99, 0xe5, 0xec, 0xd3, 0x90, 0x86, - 0x39, 0x2a, 0x6e, 0xd5, 0x32, 0xe3, 0x0d, 0x2d, - 0x01, 0x8b, 0x17, 0x55, 0x1d, 0x65, 0x57, 0xbf, - 0xd8, 0x75, 0xa4, 0x85, 0xb6, 0x4e, 0x35, 0x14, - 0x58, 0xe4, 0x89, 0xb8, 0x7a, 0x58, 0x86, 0x0c, - 0xbd, 0x8b, 0x05, 0x7b, 0x63, 0xc0, 0x86, 0x80, - 0x33, 0x46, 0xd4, 0x9b, 0xb6, 0x0a, 0xeb, 0x6c, - 0xae, 0xd6, 0x57, 0x7a, 0xc7, 0x59, 0x33, 0xa0, - 0xda, 0xa4, 0x12, 0xbf, 0x52, 0x22, 0x05, 0x8d, - 0xeb, 0xee, 0xd5, 0xec, 0xea, 0x29, 0x9b, 0x76, - 0x95, 0x50, 0x6d, 0x99, 0xe1, 0x45, 0x63, 0x09, - 0x16, 0x5f, 0xb0, 0xf2, 0x5b, 0x08, 0x33, 0xdd, - 0x8f, 0xb7, 0x60, 0x7a, 0x8e, 0xc6, 0xfc, 0xac, - 0xa9, 0x56, 0x2c, 0xa9, 0x8b, 0x74, 0x33, 0xad, - 0x2a, 0x7e, 0x96, 0xb6, 0xba, 0x22, 0x28, 0xcf, - 0x4d, 0x96, 0xb7, 0xd1, 0xfa, 0x99, 0x4a, 0x61, - 0xe6, 0x84, 0xd1, 0x94, 0xca, 0xf5, 0x86, 0xb0, - 0xba, 0x34, 0x7a, 0x04, 0xcc, 0xd4, 0x81, 0xcd, - 0xd9, 0x86, 0xb6, 0xe0, 0x5a, 0x6f, 0x9b, 0x99, - 0xf0, 0xdf, 0x49, 0xae, 0x6d, 0xc2, 0x54, 0x67, - 0xe0, 0xb4, 0x34, 0x2d, 0x1c, 0x46, 0xdf, 0x73, - 0x3b, 0x45, 0x43, 0xe7, 0x1f, 0xa3, 0x36, 0x35, - 0x25, 0x33, 0xd9, 0xc0, 0x54, 0x38, 0x6e, 0x6b, - 0x80, 0xcf, 0x50, 0xa4, 0xb6, 0x21, 0x17, 0xfd, - 0x9b, 0x5c, 0x36, 0xca, 0xcc, 0x73, 0x73, 0xad, - 0xe0, 0x57, 0x77, 0x90, 0x0e, 0x7f, 0x0f, 0x87, - 0x7f, 0xdb, 0x73, 0xbf, 0xda, 0xc2, 0xb3, 0x05, - 0x22, 0x06, 0xf5, 0xa3, 0xfc, 0x1e, 0x8f, 0xda, - 0xcf, 0x49, 0xd6, 0xb3, 0x66, 0x2c, 0xb5, 0x00, - 0xaf, 0x85, 0x6e, 0xb8, 0x5b, 0x8c, 0xa1, 0xa4, - 0x21, 0xce, 0x40, 0xf3, 0x98, 0xac, 0xec, 0x88, - 0x62, 0x43, 0x2a, 0xac, 0xca, 0xcf, 0xb9, 0x30, - 0xeb, 0xfc, 0xef, 0xf0, 0x6e, 0x64, 0x6d, 0xe7, - 0x54, 0x88, 0x6b, 0x22, 0x29, 0xbe, 0xa5, 0x8c, - 0x31, 0x23, 0x3b, 0x4a, 0x80, 0x37, 0xe6, 0xd0, - 0x05, 0xfc, 0x10, 0x0e, 0xdd, 0xbb, 0x00, 0xc5, - 0x07, 0x20, 0x59, 0xd3, 0x41, 0x17, 0x86, 0x46, - 0xab, 0x68, 0xf6, 0x48, 0x3c, 0xea, 0x5a, 0x06, - 0x30, 0x21, 0x19, 0xed, 0x74, 0xbe, 0x0b, 0x97, - 0xee, 0x91, 0x35, 0x94, 0x1f, 0xcb, 0x68, 0x7f, - 0xe4, 0x48, 0xb0, 0x16, 0xfb, 0xf0, 0x74, 0xdb, - 0x06, 0x59, 0x2e, 0x5a, 0x9c, 0xce, 0x8f, 0x7d, - 0xba, 0x48, 0xd5, 0x3f, 0x5c, 0xb0, 0xc2, 0x33, - 0x48, 0x60, 0x17, 0x08, 0x85, 0xba, 0xff, 0xb9, - 0x34, 0x0a, 0x3d, 0x8f, 0x21, 0x13, 0x12, 0x1b -}; - -static const uint8_t AES_CBC_ciphertext_1536B[] = { - 0x89, 0x93, 0x05, 0x99, 0xa9, 0xed, 0xea, 0x62, - 0xc9, 0xda, 0x51, 0x15, 0xce, 0x42, 0x91, 0xc3, - 0x80, 0xc8, 0x03, 0x88, 0xc2, 0x63, 0xda, 0x53, - 0x1a, 0xf3, 0xeb, 0xd5, 0xba, 0x6f, 0x23, 0xb2, - 0xed, 0x8f, 0x89, 0xb1, 0xb3, 0xca, 0x90, 0x7a, - 0xdd, 0x3f, 0xf6, 0xca, 0x86, 0x58, 0x54, 0xbc, - 0xab, 0x0f, 0xf4, 0xab, 0x6d, 0x5d, 0x42, 0xd0, - 0x17, 0x49, 0x17, 0xd1, 0x93, 0xea, 0xe8, 0x22, - 0xc1, 0x34, 0x9f, 0x3a, 0x3b, 0xaa, 0xe9, 0x1b, - 0x93, 0xff, 0x6b, 0x68, 0xba, 0xe6, 0xd2, 0x39, - 0x3d, 0x55, 0x34, 0x8f, 0x98, 0x86, 0xb4, 0xd8, - 0x7c, 0x0d, 0x3e, 0x01, 0x63, 0x04, 0x01, 0xff, - 0x16, 0x0f, 0x51, 0x5f, 0x73, 0x53, 0xf0, 0x3a, - 0x38, 0xb4, 0x4d, 0x8d, 0xaf, 0xa3, 0xca, 0x2f, - 0x6f, 0xdf, 0xc0, 0x41, 0x6c, 0x48, 0x60, 0x1a, - 0xe4, 0xe7, 0x8a, 0x65, 0x6f, 0x8d, 0xd7, 0xe1, - 0x10, 0xab, 0x78, 0x5b, 0xb9, 0x69, 0x1f, 0xe0, - 0x5c, 0xf1, 0x19, 0x12, 0x21, 0xc7, 0x51, 0xbc, - 0x61, 0x5f, 0xc0, 0x36, 0x17, 0xc0, 0x28, 0xd9, - 0x51, 0xcb, 0x43, 0xd9, 0xfa, 0xd1, 0xad, 0x79, - 0x69, 0x86, 0x49, 0xc5, 0xe5, 0x69, 0x27, 0xce, - 0x22, 0xd0, 0xe1, 0x6a, 0xf9, 0x02, 0xca, 0x6c, - 0x34, 0xc7, 0xb8, 0x02, 0xc1, 0x38, 0x7f, 0xd5, - 0x15, 0xf5, 0xd6, 0xeb, 0xf9, 0x30, 0x40, 0x43, - 0xea, 0x87, 0xde, 0x35, 0xf6, 0x83, 0x59, 0x09, - 0x68, 0x62, 0x00, 0x87, 0xb8, 0xe7, 0xca, 0x05, - 0x0f, 0xac, 0x42, 0x58, 0x45, 0xaa, 0xc9, 0x9b, - 0xfd, 0x2a, 0xda, 0x65, 0x33, 0x93, 0x9d, 0xc6, - 0x93, 0x8d, 0xe2, 0xc5, 0x71, 0xc1, 0x5c, 0x13, - 0xde, 0x7b, 0xd4, 0xb9, 0x4c, 0x35, 0x61, 0x85, - 0x90, 0x78, 0xf7, 0x81, 0x98, 0x45, 0x99, 0x24, - 0x58, 0x73, 0x28, 0xf8, 0x31, 0xab, 0x54, 0x2e, - 0xc0, 0x38, 0x77, 0x25, 0x5c, 0x06, 0x9c, 0xc3, - 0x69, 0x21, 0x92, 0x76, 0xe1, 0x16, 0xdc, 0xa9, - 0xee, 0xb6, 0x80, 0x66, 0x43, 0x11, 0x24, 0xb3, - 0x07, 0x17, 0x89, 0x0f, 0xcb, 0xe0, 0x60, 0xa8, - 0x9d, 0x06, 0x4b, 0x6e, 0x72, 0xb7, 0xbc, 0x4f, - 0xb8, 0xc0, 0x80, 0xa2, 0xfb, 0x46, 0x5b, 0x8f, - 0x11, 0x01, 0x92, 0x9d, 0x37, 0x09, 0x98, 0xc8, - 0x0a, 0x46, 0xae, 0x12, 0xac, 0x61, 0x3f, 0xe7, - 0x41, 0x1a, 0xaa, 0x2e, 0xdc, 0xd7, 0x2a, 0x47, - 0xee, 0xdf, 0x08, 0xd1, 0xff, 0xea, 0x13, 0xc6, - 0x05, 0xdb, 0x29, 0xcc, 0x03, 0xba, 0x7b, 0x6d, - 0x40, 0xc1, 0xc9, 0x76, 0x75, 0x03, 0x7a, 0x71, - 0xc9, 0x5f, 0xd9, 0xe0, 0x61, 0x69, 0x36, 0x8f, - 0xb2, 0xbc, 0x28, 0xf3, 0x90, 0x71, 0xda, 0x5f, - 0x08, 0xd5, 0x0d, 0xc1, 0xe6, 0xbd, 0x2b, 0xc6, - 0x6c, 0x42, 0xfd, 0xbf, 0x10, 0xe8, 0x5f, 0x87, - 0x3d, 0x21, 0x42, 0x85, 0x01, 0x0a, 0xbf, 0x8e, - 0x49, 0xd3, 0x9c, 0x89, 0x3b, 0xea, 0xe1, 0xbf, - 0xe9, 0x9b, 0x5e, 0x0e, 0xb8, 0xeb, 0xcd, 0x3a, - 0xf6, 0x29, 0x41, 0x35, 0xdd, 0x9b, 0x13, 0x24, - 0xe0, 0x1d, 0x8a, 0xcb, 0x20, 0xf8, 0x41, 0x51, - 0x3e, 0x23, 0x8c, 0x67, 0x98, 0x39, 0x53, 0x77, - 0x2a, 0x68, 0xf4, 0x3c, 0x7e, 0xd6, 0xc4, 0x6e, - 0xf1, 0x53, 0xe9, 0xd8, 0x5c, 0xc1, 0xa9, 0x38, - 0x6f, 0x5e, 0xe4, 0xd4, 0x29, 0x1c, 0x6c, 0xee, - 0x2f, 0xea, 0xde, 0x61, 0x71, 0x5a, 0xea, 0xce, - 0x23, 0x6e, 0x1b, 0x16, 0x43, 0xb7, 0xc0, 0xe3, - 0x87, 0xa1, 0x95, 0x1e, 0x97, 0x4d, 0xea, 0xa6, - 0xf7, 0x25, 0xac, 0x82, 0x2a, 0xd3, 0xa6, 0x99, - 0x75, 0xdd, 0xc1, 0x55, 0x32, 0x6b, 0xea, 0x33, - 0x88, 0xce, 0x06, 0xac, 0x15, 0x39, 0x19, 0xa3, - 0x59, 0xaf, 0x7a, 0x1f, 0xd9, 0x72, 0x5e, 0xf7, - 0x4c, 0xf3, 0x5d, 0x6b, 0xf2, 0x16, 0x92, 0xa8, - 0x9e, 0x3d, 0xd4, 0x4c, 0x72, 0x55, 0x4e, 0x4a, - 0xf7, 0x8b, 0x2f, 0x67, 0x5a, 0x90, 0xb7, 0xcf, - 0x16, 0xd3, 0x7b, 0x5a, 0x9a, 0xc8, 0x9f, 0xbf, - 0x01, 0x76, 0x3b, 0x86, 0x2c, 0x2a, 0x78, 0x10, - 0x70, 0x05, 0x38, 0xf9, 0xdd, 0x2a, 0x1d, 0x00, - 0x25, 0xb7, 0x10, 0xac, 0x3b, 0x3c, 0x4d, 0x3c, - 0x01, 0x68, 0x3c, 0x5a, 0x29, 0xc2, 0xa0, 0x1b, - 0x95, 0x67, 0xf9, 0x0a, 0x60, 0xb7, 0x11, 0x9c, - 0x40, 0x45, 0xd7, 0xb0, 0xda, 0x49, 0x87, 0xcd, - 0xb0, 0x9b, 0x61, 0x8c, 0xf4, 0x0d, 0x94, 0x1d, - 0x79, 0x66, 0x13, 0x0b, 0xc6, 0x6b, 0x19, 0xee, - 0xa0, 0x6b, 0x64, 0x7d, 0xc4, 0xff, 0x98, 0x72, - 0x60, 0xab, 0x7f, 0x0f, 0x4d, 0x5d, 0x6b, 0xc3, - 0xba, 0x5e, 0x0d, 0x04, 0xd9, 0x59, 0x17, 0xd0, - 0x64, 0xbe, 0xfb, 0x58, 0xfc, 0xed, 0x18, 0xf6, - 0xac, 0x19, 0xa4, 0xfd, 0x16, 0x59, 0x80, 0x58, - 0xb8, 0x0f, 0x79, 0x24, 0x60, 0x18, 0x62, 0xa9, - 0xa3, 0xa0, 0xe8, 0x81, 0xd6, 0xec, 0x5b, 0xfe, - 0x5b, 0xb8, 0xa4, 0x00, 0xa9, 0xd0, 0x90, 0x17, - 0xe5, 0x50, 0x3d, 0x2b, 0x12, 0x6e, 0x2a, 0x13, - 0x65, 0x7c, 0xdf, 0xdf, 0xa7, 0xdd, 0x9f, 0x78, - 0x5f, 0x8f, 0x4e, 0x90, 0xa6, 0x10, 0xe4, 0x7b, - 0x68, 0x6b, 0xfd, 0xa9, 0x6d, 0x47, 0xfa, 0xec, - 0x42, 0x35, 0x07, 0x12, 0x3e, 0x78, 0x23, 0x15, - 0xff, 0xe2, 0x65, 0xc7, 0x47, 0x89, 0x2f, 0x97, - 0x7c, 0xd7, 0x6b, 0x69, 0x35, 0x79, 0x6f, 0x85, - 0xb4, 0xa9, 0x75, 0x04, 0x32, 0x9a, 0xfe, 0xf0, - 0xce, 0xe3, 0xf1, 0xab, 0x15, 0x47, 0xe4, 0x9c, - 0xc1, 0x48, 0x32, 0x3c, 0xbe, 0x44, 0x72, 0xc9, - 0xaa, 0x50, 0x37, 0xa6, 0xbe, 0x41, 0xcf, 0xe8, - 0x17, 0x4e, 0x37, 0xbe, 0xf1, 0x34, 0x2c, 0xd9, - 0x60, 0x48, 0x09, 0xa5, 0x26, 0x00, 0x31, 0x77, - 0x4e, 0xac, 0x7c, 0x89, 0x75, 0xe3, 0xde, 0x26, - 0x4c, 0x32, 0x54, 0x27, 0x8e, 0x92, 0x26, 0x42, - 0x85, 0x76, 0x01, 0x76, 0x62, 0x4c, 0x29, 0xe9, - 0x38, 0x05, 0x51, 0x54, 0x97, 0xa3, 0x03, 0x59, - 0x5e, 0xec, 0x0c, 0xe4, 0x96, 0xb7, 0x15, 0xa8, - 0x41, 0x06, 0x2b, 0x78, 0x95, 0x24, 0xf6, 0x32, - 0xc5, 0xec, 0xd7, 0x89, 0x28, 0x1e, 0xec, 0xb1, - 0xc7, 0x21, 0x0c, 0xd3, 0x80, 0x7c, 0x5a, 0xe6, - 0xb1, 0x3a, 0x52, 0x33, 0x84, 0x4e, 0x32, 0x6e, - 0x7a, 0xf6, 0x43, 0x15, 0x5b, 0xa6, 0xba, 0xeb, - 0xa8, 0xe4, 0xff, 0x4f, 0xbd, 0xbd, 0xa8, 0x5e, - 0xbe, 0x27, 0xaf, 0xc5, 0xf7, 0x9e, 0xdf, 0x48, - 0x22, 0xca, 0x6a, 0x0b, 0x3c, 0xd7, 0xe0, 0xdc, - 0xf3, 0x71, 0x08, 0xdc, 0x28, 0x13, 0x08, 0xf2, - 0x08, 0x1d, 0x9d, 0x7b, 0xd9, 0xde, 0x6f, 0xe6, - 0xe8, 0x88, 0x18, 0xc2, 0xcd, 0x93, 0xc5, 0x38, - 0x21, 0x68, 0x4c, 0x9a, 0xfb, 0xb6, 0x18, 0x16, - 0x73, 0x2c, 0x1d, 0x6f, 0x95, 0xfb, 0x65, 0x4f, - 0x7c, 0xec, 0x8d, 0x6c, 0xa8, 0xc0, 0x55, 0x28, - 0xc6, 0xc3, 0xea, 0xeb, 0x05, 0xf5, 0x65, 0xeb, - 0x53, 0xe1, 0x54, 0xef, 0xb8, 0x64, 0x98, 0x2d, - 0x98, 0x9e, 0xc8, 0xfe, 0xa2, 0x07, 0x30, 0xf7, - 0xf7, 0xae, 0xdb, 0x32, 0xf8, 0x71, 0x9d, 0x06, - 0xdf, 0x9b, 0xda, 0x61, 0x7d, 0xdb, 0xae, 0x06, - 0x24, 0x63, 0x74, 0xb6, 0xf3, 0x1b, 0x66, 0x09, - 0x60, 0xff, 0x2b, 0x29, 0xf5, 0xa9, 0x9d, 0x61, - 0x5d, 0x55, 0x10, 0x82, 0x21, 0xbb, 0x64, 0x0d, - 0xef, 0x5c, 0xe3, 0x30, 0x1b, 0x60, 0x1e, 0x5b, - 0xfe, 0x6c, 0xf5, 0x15, 0xa3, 0x86, 0x27, 0x58, - 0x46, 0x00, 0x20, 0xcb, 0x86, 0x9a, 0x52, 0x29, - 0x20, 0x68, 0x4d, 0x67, 0x88, 0x70, 0xc2, 0x31, - 0xd8, 0xbb, 0xa5, 0xa7, 0x88, 0x7f, 0x66, 0xbc, - 0xaa, 0x0f, 0xe1, 0x78, 0x7b, 0x97, 0x3c, 0xb7, - 0xd7, 0xd8, 0x04, 0xe0, 0x09, 0x60, 0xc8, 0xd0, - 0x9e, 0xe5, 0x6b, 0x31, 0x7f, 0x88, 0xfe, 0xc3, - 0xfd, 0x89, 0xec, 0x76, 0x4b, 0xb3, 0xa7, 0x37, - 0x03, 0xb7, 0xc6, 0x10, 0x7c, 0x9d, 0x0c, 0x75, - 0xd3, 0x08, 0x14, 0x94, 0x03, 0x42, 0x25, 0x26, - 0x85, 0xf7, 0xf0, 0x90, 0x06, 0x3e, 0x6f, 0x60, - 0x52, 0x55, 0xd5, 0x0f, 0x79, 0x64, 0x69, 0x69, - 0x46, 0xf9, 0x7f, 0x7f, 0x03, 0xf1, 0x1f, 0xdb, - 0x39, 0x05, 0xba, 0x4a, 0x8f, 0x17, 0xe7, 0xba, - 0xe2, 0x07, 0x7c, 0x1d, 0x9e, 0xbc, 0x94, 0xc0, - 0x61, 0x59, 0x8e, 0x72, 0xaf, 0xfc, 0x99, 0xe4, - 0xd5, 0xa8, 0xee, 0x0a, 0x48, 0x2d, 0x82, 0x8b, - 0x34, 0x54, 0x8a, 0xce, 0xc7, 0xfa, 0xdd, 0xba, - 0x54, 0xdf, 0xb3, 0x30, 0x33, 0x73, 0x2e, 0xd5, - 0x52, 0xab, 0x49, 0x91, 0x4e, 0x0a, 0xd6, 0x2f, - 0x67, 0xe4, 0xdd, 0x64, 0x48, 0x16, 0xd9, 0x85, - 0xaa, 0x52, 0xa5, 0x0b, 0xd3, 0xb4, 0x2d, 0x77, - 0x5e, 0x52, 0x77, 0x17, 0xcf, 0xbe, 0x88, 0x04, - 0x01, 0x52, 0xe2, 0xf1, 0x46, 0xe2, 0x91, 0x30, - 0x65, 0xcf, 0xc0, 0x65, 0x45, 0xc3, 0x7e, 0xf4, - 0x2e, 0xb5, 0xaf, 0x6f, 0xab, 0x1a, 0xfa, 0x70, - 0x35, 0xb8, 0x4f, 0x2d, 0x78, 0x90, 0x33, 0xb5, - 0x9a, 0x67, 0xdb, 0x2f, 0x28, 0x32, 0xb6, 0x54, - 0xab, 0x4c, 0x6b, 0x85, 0xed, 0x6c, 0x3e, 0x05, - 0x2a, 0xc7, 0x32, 0xe8, 0xf5, 0xa3, 0x7b, 0x4e, - 0x7b, 0x58, 0x24, 0x73, 0xf7, 0xfd, 0xc7, 0xc8, - 0x6c, 0x71, 0x68, 0xb1, 0xf6, 0xc5, 0x9e, 0x1e, - 0xe3, 0x5c, 0x25, 0xc0, 0x5b, 0x3e, 0x59, 0xa1, - 0x18, 0x5a, 0xe8, 0xb5, 0xd1, 0x44, 0x13, 0xa3, - 0xe6, 0x05, 0x76, 0xd2, 0x8d, 0x6e, 0x54, 0x68, - 0x0c, 0xa4, 0x7b, 0x8b, 0xd3, 0x8c, 0x42, 0x13, - 0x87, 0xda, 0xdf, 0x8f, 0xa5, 0x83, 0x7a, 0x42, - 0x99, 0xb7, 0xeb, 0xe2, 0x79, 0xe0, 0xdb, 0xda, - 0x33, 0xa8, 0x50, 0x3a, 0xd7, 0xe7, 0xd3, 0x61, - 0x18, 0xb8, 0xaa, 0x2d, 0xc8, 0xd8, 0x2c, 0x28, - 0xe5, 0x97, 0x0a, 0x7c, 0x6c, 0x7f, 0x09, 0xd7, - 0x88, 0x80, 0xac, 0x12, 0xed, 0xf8, 0xc6, 0xb5, - 0x2d, 0xd6, 0x63, 0x9b, 0x98, 0x35, 0x26, 0xde, - 0xf6, 0x31, 0xee, 0x7e, 0xa0, 0xfb, 0x16, 0x98, - 0xb1, 0x96, 0x1d, 0xee, 0xe3, 0x2f, 0xfb, 0x41, - 0xdd, 0xea, 0x10, 0x1e, 0x03, 0x89, 0x18, 0xd2, - 0x47, 0x0c, 0xa0, 0x57, 0xda, 0x76, 0x3a, 0x37, - 0x2c, 0xe4, 0xf9, 0x77, 0xc8, 0x43, 0x5f, 0xcb, - 0xd6, 0x85, 0xf7, 0x22, 0xe4, 0x32, 0x25, 0xa8, - 0xdc, 0x21, 0xc0, 0xf5, 0x95, 0xb2, 0xf8, 0x83, - 0xf0, 0x65, 0x61, 0x15, 0x48, 0x94, 0xb7, 0x03, - 0x7f, 0x66, 0xa1, 0x39, 0x1f, 0xdd, 0xce, 0x96, - 0xfe, 0x58, 0x81, 0x3d, 0x41, 0x11, 0x87, 0x13, - 0x26, 0x1b, 0x6d, 0xf3, 0xca, 0x2e, 0x2c, 0x76, - 0xd3, 0x2f, 0x6d, 0x49, 0x70, 0x53, 0x05, 0x96, - 0xcc, 0x30, 0x2b, 0x83, 0xf2, 0xc6, 0xb2, 0x4b, - 0x22, 0x13, 0x95, 0x42, 0xeb, 0x56, 0x4d, 0x22, - 0xe6, 0x43, 0x6f, 0xba, 0xe7, 0x3b, 0xe5, 0x59, - 0xce, 0x57, 0x88, 0x85, 0xb6, 0xbf, 0x15, 0x37, - 0xb3, 0x7a, 0x7e, 0xc4, 0xbc, 0x99, 0xfc, 0xe4, - 0x89, 0x00, 0x68, 0x39, 0xbc, 0x5a, 0xba, 0xab, - 0x52, 0xab, 0xe6, 0x81, 0xfd, 0x93, 0x62, 0xe9, - 0xb7, 0x12, 0xd1, 0x18, 0x1a, 0xb9, 0x55, 0x4a, - 0x0f, 0xae, 0x35, 0x11, 0x04, 0x27, 0xf3, 0x42, - 0x4e, 0xca, 0xdf, 0x9f, 0x12, 0x62, 0xea, 0x03, - 0xc0, 0xa9, 0x22, 0x7b, 0x6c, 0x6c, 0xe3, 0xdf, - 0x16, 0xad, 0x03, 0xc9, 0xfe, 0xa4, 0xdd, 0x4f -}; - -static const uint8_t AES_CBC_ciphertext_1792B[] = { - 0x59, 0xcc, 0xfe, 0x8f, 0xb4, 0x9d, 0x0e, 0xd1, - 0x85, 0xfc, 0x9b, 0x43, 0xc1, 0xb7, 0x54, 0x67, - 0x01, 0xef, 0xb8, 0x71, 0x36, 0xdb, 0x50, 0x48, - 0x7a, 0xea, 0xcf, 0xce, 0xba, 0x30, 0x10, 0x2e, - 0x96, 0x2b, 0xfd, 0xcf, 0x00, 0xe3, 0x1f, 0xac, - 0x66, 0x14, 0x30, 0x86, 0x49, 0xdb, 0x01, 0x8b, - 0x07, 0xdd, 0x00, 0x9d, 0x0d, 0x5c, 0x19, 0x11, - 0xe8, 0x44, 0x2b, 0x25, 0x70, 0xed, 0x7c, 0x33, - 0x0d, 0xe3, 0x34, 0x93, 0x63, 0xad, 0x26, 0xb1, - 0x11, 0x91, 0x34, 0x2e, 0x1d, 0x50, 0xaa, 0xd4, - 0xef, 0x3a, 0x6d, 0xd7, 0x33, 0x20, 0x0d, 0x3f, - 0x9b, 0xdd, 0xc3, 0xa5, 0xc5, 0xf1, 0x99, 0xdc, - 0xea, 0x52, 0xda, 0x55, 0xea, 0xa2, 0x7a, 0xc5, - 0x78, 0x44, 0x4a, 0x02, 0x33, 0x19, 0x62, 0x37, - 0xf8, 0x8b, 0xd1, 0x0c, 0x21, 0xdf, 0x40, 0x19, - 0x81, 0xea, 0xfb, 0x1c, 0xa7, 0xcc, 0x60, 0xfe, - 0x63, 0x25, 0x8f, 0xf3, 0x73, 0x0f, 0x45, 0xe6, - 0x6a, 0x18, 0xbf, 0xbe, 0xad, 0x92, 0x2a, 0x1e, - 0x15, 0x65, 0x6f, 0xef, 0x92, 0xcd, 0x0e, 0x19, - 0x3d, 0x42, 0xa8, 0xfc, 0x0d, 0x32, 0x58, 0xe0, - 0x56, 0x9f, 0xd6, 0x9b, 0x8b, 0xec, 0xe0, 0x45, - 0x4d, 0x7e, 0x73, 0x87, 0xff, 0x74, 0x92, 0x59, - 0x60, 0x13, 0x93, 0xda, 0xec, 0xbf, 0xfa, 0x20, - 0xb6, 0xe7, 0xdf, 0xc7, 0x10, 0xf5, 0x79, 0xb4, - 0xd7, 0xac, 0xaf, 0x2b, 0x37, 0x52, 0x30, 0x1d, - 0xbe, 0x0f, 0x60, 0x77, 0x3d, 0x03, 0x63, 0xa9, - 0xae, 0xb1, 0xf3, 0xca, 0xca, 0xb4, 0x21, 0xd7, - 0x6f, 0x2e, 0x5e, 0x9b, 0x68, 0x53, 0x80, 0xab, - 0x30, 0x23, 0x0a, 0x72, 0x6b, 0xb1, 0xd8, 0x25, - 0x5d, 0x3a, 0x62, 0x9b, 0x4f, 0x59, 0x3b, 0x79, - 0xa8, 0x9e, 0x08, 0x6d, 0x37, 0xb0, 0xfc, 0x42, - 0x51, 0x25, 0x86, 0xbd, 0x54, 0x5a, 0x95, 0x20, - 0x6c, 0xac, 0xb9, 0x30, 0x1c, 0x03, 0xc9, 0x49, - 0x38, 0x55, 0x31, 0x49, 0xed, 0xa9, 0x0e, 0xc3, - 0x65, 0xb4, 0x68, 0x6b, 0x07, 0x4c, 0x0a, 0xf9, - 0x21, 0x69, 0x7c, 0x9f, 0x28, 0x80, 0xe9, 0x49, - 0x22, 0x7c, 0xec, 0x97, 0xf7, 0x70, 0xb4, 0xb8, - 0x25, 0xe7, 0x80, 0x2c, 0x43, 0x24, 0x8a, 0x2e, - 0xac, 0xa2, 0x84, 0x20, 0xe7, 0xf4, 0x6b, 0x86, - 0x37, 0x05, 0xc7, 0x59, 0x04, 0x49, 0x2a, 0x99, - 0x80, 0x46, 0x32, 0x19, 0xe6, 0x30, 0xce, 0xc0, - 0xef, 0x6e, 0xec, 0xe5, 0x2f, 0x24, 0xc1, 0x78, - 0x45, 0x02, 0xd3, 0x64, 0x99, 0xf5, 0xc7, 0xbc, - 0x8f, 0x8c, 0x75, 0xb1, 0x0a, 0xc8, 0xc3, 0xbd, - 0x5e, 0x7e, 0xbd, 0x0e, 0xdf, 0x4b, 0x96, 0x6a, - 0xfd, 0x03, 0xdb, 0xd1, 0x31, 0x1e, 0x27, 0xf9, - 0xe5, 0x83, 0x9a, 0xfc, 0x13, 0x4c, 0xd3, 0x04, - 0xdb, 0xdb, 0x3f, 0x35, 0x93, 0x4e, 0x14, 0x6b, - 0x00, 0x5c, 0xb6, 0x11, 0x50, 0xee, 0x61, 0x5c, - 0x10, 0x5c, 0xd0, 0x90, 0x02, 0x2e, 0x12, 0xe0, - 0x50, 0x44, 0xad, 0x75, 0xcd, 0x94, 0xcf, 0x92, - 0xcb, 0xe3, 0xe8, 0x77, 0x4b, 0xd7, 0x1a, 0x7c, - 0xdd, 0x6b, 0x49, 0x21, 0x7c, 0xe8, 0x2c, 0x25, - 0x49, 0x86, 0x1e, 0x54, 0xae, 0xfc, 0x0e, 0x80, - 0xb1, 0xd5, 0xa5, 0x23, 0xcf, 0xcc, 0x0e, 0x11, - 0xe2, 0x7c, 0x3c, 0x25, 0x78, 0x64, 0x03, 0xa1, - 0xdd, 0x9f, 0x74, 0x12, 0x7b, 0x21, 0xb5, 0x73, - 0x15, 0x3c, 0xed, 0xad, 0x07, 0x62, 0x21, 0x79, - 0xd4, 0x2f, 0x0d, 0x72, 0xe9, 0x7c, 0x6b, 0x96, - 0x6e, 0xe5, 0x36, 0x4a, 0xd2, 0x38, 0xe1, 0xff, - 0x6e, 0x26, 0xa4, 0xac, 0x83, 0x07, 0xe6, 0x67, - 0x74, 0x6c, 0xec, 0x8b, 0x4b, 0x79, 0x33, 0x50, - 0x2f, 0x8f, 0xa0, 0x8f, 0xfa, 0x38, 0x6a, 0xa2, - 0x3a, 0x42, 0x85, 0x15, 0x90, 0xd0, 0xb3, 0x0d, - 0x8a, 0xe4, 0x60, 0x03, 0xef, 0xf9, 0x65, 0x8a, - 0x4e, 0x50, 0x8c, 0x65, 0xba, 0x61, 0x16, 0xc3, - 0x93, 0xb7, 0x75, 0x21, 0x98, 0x25, 0x60, 0x6e, - 0x3d, 0x68, 0xba, 0x7c, 0xe4, 0xf3, 0xd9, 0x9b, - 0xfb, 0x7a, 0xed, 0x1f, 0xb3, 0x4b, 0x88, 0x74, - 0x2c, 0xb8, 0x8c, 0x22, 0x95, 0xce, 0x90, 0xf1, - 0xdb, 0x80, 0xa6, 0x39, 0xae, 0x82, 0xa1, 0xef, - 0x75, 0xec, 0xfe, 0xf1, 0xe8, 0x04, 0xfd, 0x99, - 0x1b, 0x5f, 0x45, 0x87, 0x4f, 0xfa, 0xa2, 0x3e, - 0x3e, 0xb5, 0x01, 0x4b, 0x46, 0xeb, 0x13, 0x9a, - 0xe4, 0x7d, 0x03, 0x87, 0xb1, 0x59, 0x91, 0x8e, - 0x37, 0xd3, 0x16, 0xce, 0xef, 0x4b, 0xe9, 0x46, - 0x8d, 0x2a, 0x50, 0x2f, 0x41, 0xd3, 0x7b, 0xcf, - 0xf0, 0xb7, 0x8b, 0x65, 0x0f, 0xa3, 0x27, 0x10, - 0xe9, 0xa9, 0xe9, 0x2c, 0xbe, 0xbb, 0x82, 0xe3, - 0x7b, 0x0b, 0x81, 0x3e, 0xa4, 0x6a, 0x4f, 0x3b, - 0xd5, 0x61, 0xf8, 0x47, 0x04, 0x99, 0x5b, 0xff, - 0xf3, 0x14, 0x6e, 0x57, 0x5b, 0xbf, 0x1b, 0xb4, - 0x3f, 0xf9, 0x31, 0xf6, 0x95, 0xd5, 0x10, 0xa9, - 0x72, 0x28, 0x23, 0xa9, 0x6a, 0xa2, 0xcf, 0x7d, - 0xe3, 0x18, 0x95, 0xda, 0xbc, 0x6f, 0xe9, 0xd8, - 0xef, 0x49, 0x3f, 0xd3, 0xef, 0x1f, 0xe1, 0x50, - 0xe8, 0x8a, 0xc0, 0xce, 0xcc, 0xb7, 0x5e, 0x0e, - 0x8b, 0x95, 0x80, 0xfd, 0x58, 0x2a, 0x9b, 0xc8, - 0xb4, 0x17, 0x04, 0x46, 0x74, 0xd4, 0x68, 0x91, - 0x33, 0xc8, 0x31, 0x15, 0x84, 0x16, 0x35, 0x03, - 0x64, 0x6d, 0xa9, 0x4e, 0x20, 0xeb, 0xa9, 0x3f, - 0x21, 0x5e, 0x9b, 0x09, 0xc3, 0x45, 0xf8, 0x7c, - 0x59, 0x62, 0x29, 0x9a, 0x5c, 0xcf, 0xb4, 0x27, - 0x5e, 0x13, 0xea, 0xb3, 0xef, 0xd9, 0x01, 0x2a, - 0x65, 0x5f, 0x14, 0xf4, 0xbf, 0x28, 0x89, 0x3d, - 0xdd, 0x9d, 0x52, 0xbd, 0x9e, 0x5b, 0x3b, 0xd2, - 0xc2, 0x81, 0x35, 0xb6, 0xac, 0xdd, 0x27, 0xc3, - 0x7b, 0x01, 0x5a, 0x6d, 0x4c, 0x5e, 0x2c, 0x30, - 0xcb, 0x3a, 0xfa, 0xc1, 0xd7, 0x31, 0x67, 0x3e, - 0x08, 0x6a, 0xe8, 0x8c, 0x75, 0xac, 0x1a, 0x6a, - 0x52, 0xf7, 0x51, 0xcd, 0x85, 0x3f, 0x3c, 0xa7, - 0xea, 0xbc, 0xd7, 0x18, 0x9e, 0x27, 0x73, 0xe6, - 0x2b, 0x58, 0xb6, 0xd2, 0x29, 0x68, 0xd5, 0x8f, - 0x00, 0x4d, 0x55, 0xf6, 0x61, 0x5a, 0xcc, 0x51, - 0xa6, 0x5e, 0x85, 0xcb, 0x0b, 0xfd, 0x06, 0xca, - 0xf5, 0xbf, 0x0d, 0x13, 0x74, 0x78, 0x6d, 0x9e, - 0x20, 0x11, 0x84, 0x3e, 0x78, 0x17, 0x04, 0x4f, - 0x64, 0x2c, 0x3b, 0x3e, 0x93, 0x7b, 0x58, 0x33, - 0x07, 0x52, 0xf7, 0x60, 0x6a, 0xa8, 0x3b, 0x19, - 0x27, 0x7a, 0x93, 0xc5, 0x53, 0xad, 0xec, 0xf6, - 0xc8, 0x94, 0xee, 0x92, 0xea, 0xee, 0x7e, 0xea, - 0xb9, 0x5f, 0xac, 0x59, 0x5d, 0x2e, 0x78, 0x53, - 0x72, 0x81, 0x92, 0xdd, 0x1c, 0x63, 0xbe, 0x02, - 0xeb, 0xa8, 0x1b, 0x2a, 0x6e, 0x72, 0xe3, 0x2d, - 0x84, 0x0d, 0x8a, 0x22, 0xf6, 0xba, 0xab, 0x04, - 0x8e, 0x04, 0x24, 0xdb, 0xcc, 0xe2, 0x69, 0xeb, - 0x4e, 0xfa, 0x6b, 0x5b, 0xc8, 0xc0, 0xd9, 0x25, - 0xcb, 0x40, 0x8d, 0x4b, 0x8e, 0xa0, 0xd4, 0x72, - 0x98, 0x36, 0x46, 0x3b, 0x4f, 0x5f, 0x96, 0x84, - 0x03, 0x28, 0x86, 0x4d, 0xa1, 0x8a, 0xd7, 0xb2, - 0x5b, 0x27, 0x01, 0x80, 0x62, 0x49, 0x56, 0xb9, - 0xa0, 0xa1, 0xe3, 0x6e, 0x22, 0x2a, 0x5d, 0x03, - 0x86, 0x40, 0x36, 0x22, 0x5e, 0xd2, 0xe5, 0xc0, - 0x6b, 0xfa, 0xac, 0x80, 0x4e, 0x09, 0x99, 0xbc, - 0x2f, 0x9b, 0xcc, 0xf3, 0x4e, 0xf7, 0x99, 0x98, - 0x11, 0x6e, 0x6f, 0x62, 0x22, 0x6b, 0x92, 0x95, - 0x3b, 0xc3, 0xd2, 0x8e, 0x0f, 0x07, 0xc2, 0x51, - 0x5c, 0x4d, 0xb2, 0x6e, 0xc0, 0x27, 0x73, 0xcd, - 0x57, 0xb7, 0xf0, 0xe9, 0x2e, 0xc8, 0xe2, 0x0c, - 0xd1, 0xb5, 0x0f, 0xff, 0xf9, 0xec, 0x38, 0xba, - 0x97, 0xd6, 0x94, 0x9b, 0xd1, 0x79, 0xb6, 0x6a, - 0x01, 0x17, 0xe4, 0x7e, 0xa6, 0xd5, 0x86, 0x19, - 0xae, 0xf3, 0xf0, 0x62, 0x73, 0xc0, 0xf0, 0x0a, - 0x7a, 0x96, 0x93, 0x72, 0x89, 0x7e, 0x25, 0x57, - 0xf8, 0xf7, 0xd5, 0x1e, 0xe5, 0xac, 0xd6, 0x38, - 0x4f, 0xe8, 0x81, 0xd1, 0x53, 0x41, 0x07, 0x2d, - 0x58, 0x34, 0x1c, 0xef, 0x74, 0x2e, 0x61, 0xca, - 0xd3, 0xeb, 0xd6, 0x93, 0x0a, 0xf2, 0xf2, 0x86, - 0x9c, 0xe3, 0x7a, 0x52, 0xf5, 0x42, 0xf1, 0x8b, - 0x10, 0xf2, 0x25, 0x68, 0x7e, 0x61, 0xb1, 0x19, - 0xcf, 0x8f, 0x5a, 0x53, 0xb7, 0x68, 0x4f, 0x1a, - 0x71, 0xe9, 0x83, 0x91, 0x3a, 0x78, 0x0f, 0xf7, - 0xd4, 0x74, 0xf5, 0x06, 0xd2, 0x88, 0xb0, 0x06, - 0xe5, 0xc0, 0xfb, 0xb3, 0x91, 0xad, 0xc0, 0x84, - 0x31, 0xf2, 0x3a, 0xcf, 0x63, 0xe6, 0x4a, 0xd3, - 0x78, 0xbe, 0xde, 0x73, 0x3e, 0x02, 0x8e, 0xb8, - 0x3a, 0xf6, 0x55, 0xa7, 0xf8, 0x5a, 0xb5, 0x0e, - 0x0c, 0xc5, 0xe5, 0x66, 0xd5, 0xd2, 0x18, 0xf3, - 0xef, 0xa5, 0xc9, 0x68, 0x69, 0xe0, 0xcd, 0x00, - 0x33, 0x99, 0x6e, 0xea, 0xcb, 0x06, 0x7a, 0xe1, - 0xe1, 0x19, 0x0b, 0xe7, 0x08, 0xcd, 0x09, 0x1b, - 0x85, 0xec, 0xc4, 0xd4, 0x75, 0xf0, 0xd6, 0xfb, - 0x84, 0x95, 0x07, 0x44, 0xca, 0xa5, 0x2a, 0x6c, - 0xc2, 0x00, 0x58, 0x08, 0x87, 0x9e, 0x0a, 0xd4, - 0x06, 0xe2, 0x91, 0x5f, 0xb7, 0x1b, 0x11, 0xfa, - 0x85, 0xfc, 0x7c, 0xf2, 0x0f, 0x6e, 0x3c, 0x8a, - 0xe1, 0x0f, 0xa0, 0x33, 0x84, 0xce, 0x81, 0x4d, - 0x32, 0x4d, 0xeb, 0x41, 0xcf, 0x5a, 0x05, 0x60, - 0x47, 0x6c, 0x2a, 0xc4, 0x17, 0xd5, 0x16, 0x3a, - 0xe4, 0xe7, 0xab, 0x84, 0x94, 0x22, 0xff, 0x56, - 0xb0, 0x0c, 0x92, 0x6c, 0x19, 0x11, 0x4c, 0xb3, - 0xed, 0x58, 0x48, 0x84, 0x2a, 0xe2, 0x19, 0x2a, - 0xe1, 0xc0, 0x56, 0x82, 0x3c, 0x83, 0xb4, 0x58, - 0x2d, 0xf0, 0xb5, 0x1e, 0x76, 0x85, 0x51, 0xc2, - 0xe4, 0x95, 0x27, 0x96, 0xd1, 0x90, 0xc3, 0x17, - 0x75, 0xa1, 0xbb, 0x46, 0x5f, 0xa6, 0xf2, 0xef, - 0x71, 0x56, 0x92, 0xc5, 0x8a, 0x85, 0x52, 0xe4, - 0x63, 0x21, 0x6f, 0x55, 0x85, 0x2b, 0x6b, 0x0d, - 0xc9, 0x92, 0x77, 0x67, 0xe3, 0xff, 0x2a, 0x2b, - 0x90, 0x01, 0x3d, 0x74, 0x63, 0x04, 0x61, 0x3c, - 0x8e, 0xf8, 0xfc, 0x04, 0xdd, 0x21, 0x85, 0x92, - 0x1e, 0x4d, 0x51, 0x8d, 0xb5, 0x6b, 0xf1, 0xda, - 0x96, 0xf5, 0x8e, 0x3c, 0x38, 0x5a, 0xac, 0x9b, - 0xba, 0x0c, 0x84, 0x5d, 0x50, 0x12, 0xc7, 0xc5, - 0x7a, 0xcb, 0xb1, 0xfa, 0x16, 0x93, 0xdf, 0x98, - 0xda, 0x3f, 0x49, 0xa3, 0x94, 0x78, 0x70, 0xc7, - 0x0b, 0xb6, 0x91, 0xa6, 0x16, 0x2e, 0xcf, 0xfd, - 0x51, 0x6a, 0x5b, 0xad, 0x7a, 0xdd, 0xa9, 0x48, - 0x48, 0xac, 0xd6, 0x45, 0xbc, 0x23, 0x31, 0x1d, - 0x86, 0x54, 0x8a, 0x7f, 0x04, 0x97, 0x71, 0x9e, - 0xbc, 0x2e, 0x6b, 0xd9, 0x33, 0xc8, 0x20, 0xc9, - 0xe0, 0x25, 0x86, 0x59, 0x15, 0xcf, 0x63, 0xe5, - 0x99, 0xf1, 0x24, 0xf1, 0xba, 0xc4, 0x15, 0x02, - 0xe2, 0xdb, 0xfe, 0x4a, 0xf8, 0x3b, 0x91, 0x13, - 0x8d, 0x03, 0x81, 0x9f, 0xb3, 0x3f, 0x04, 0x03, - 0x58, 0xc0, 0xef, 0x27, 0x82, 0x14, 0xd2, 0x7f, - 0x93, 0x70, 0xb7, 0xb2, 0x02, 0x21, 0xb3, 0x07, - 0x7f, 0x1c, 0xef, 0x88, 0xee, 0x29, 0x7a, 0x0b, - 0x3d, 0x75, 0x5a, 0x93, 0xfe, 0x7f, 0x14, 0xf7, - 0x4e, 0x4b, 0x7f, 0x21, 0x02, 0xad, 0xf9, 0x43, - 0x29, 0x1a, 0xe8, 0x1b, 0xf5, 0x32, 0xb2, 0x96, - 0xe6, 0xe8, 0x96, 0x20, 0x9b, 0x96, 0x8e, 0x7b, - 0xfe, 0xd8, 0xc9, 0x9c, 0x65, 0x16, 0xd6, 0x68, - 0x95, 0xf8, 0x22, 0xe2, 0xae, 0x84, 0x03, 0xfd, - 0x87, 0xa2, 0x72, 0x79, 0x74, 0x95, 0xfa, 0xe1, - 0xfe, 0xd0, 0x4e, 0x3d, 0x39, 0x2e, 0x67, 0x55, - 0x71, 0x6c, 0x89, 0x33, 0x49, 0x0c, 0x1b, 0x46, - 0x92, 0x31, 0x6f, 0xa6, 0xf0, 0x09, 0xbd, 0x2d, - 0xe2, 0xca, 0xda, 0x18, 0x33, 0xce, 0x67, 0x37, - 0xfd, 0x6f, 0xcb, 0x9d, 0xbd, 0x42, 0xbc, 0xb2, - 0x9c, 0x28, 0xcd, 0x65, 0x3c, 0x61, 0xbc, 0xde, - 0x9d, 0xe1, 0x2a, 0x3e, 0xbf, 0xee, 0x3c, 0xcb, - 0xb1, 0x50, 0xa9, 0x2c, 0xbe, 0xb5, 0x43, 0xd0, - 0xec, 0x29, 0xf9, 0x16, 0x6f, 0x31, 0xd9, 0x9b, - 0x92, 0xb1, 0x32, 0xae, 0x0f, 0xb6, 0x9d, 0x0e, - 0x25, 0x7f, 0x89, 0x1f, 0x1d, 0x01, 0x68, 0xab, - 0x3d, 0xd1, 0x74, 0x5b, 0x4c, 0x38, 0x7f, 0x3d, - 0x33, 0xa5, 0xa2, 0x9f, 0xda, 0x84, 0xa5, 0x82, - 0x2d, 0x16, 0x66, 0x46, 0x08, 0x30, 0x14, 0x48, - 0x5e, 0xca, 0xe3, 0xf4, 0x8c, 0xcb, 0x32, 0xc6, - 0xf1, 0x43, 0x62, 0xc6, 0xef, 0x16, 0xfa, 0x43, - 0xae, 0x9c, 0x53, 0xe3, 0x49, 0x45, 0x80, 0xfd, - 0x1d, 0x8c, 0xa9, 0x6d, 0x77, 0x76, 0xaa, 0x40, - 0xc4, 0x4e, 0x7b, 0x78, 0x6b, 0xe0, 0x1d, 0xce, - 0x56, 0x3d, 0xf0, 0x11, 0xfe, 0x4f, 0x6a, 0x6d, - 0x0f, 0x4f, 0x90, 0x38, 0x92, 0x17, 0xfa, 0x56, - 0x12, 0xa6, 0xa1, 0x0a, 0xea, 0x2f, 0x50, 0xf9, - 0x60, 0x66, 0x6c, 0x7d, 0x5a, 0x08, 0x8e, 0x3c, - 0xf3, 0xf0, 0x33, 0x02, 0x11, 0x02, 0xfe, 0x4c, - 0x56, 0x2b, 0x9f, 0x0c, 0xbd, 0x65, 0x8a, 0x83, - 0xde, 0x7c, 0x05, 0x26, 0x93, 0x19, 0xcc, 0xf3, - 0x71, 0x0e, 0xad, 0x2f, 0xb3, 0xc9, 0x38, 0x50, - 0x64, 0xd5, 0x4c, 0x60, 0x5f, 0x02, 0x13, 0x34, - 0xc9, 0x75, 0xc4, 0x60, 0xab, 0x2e, 0x17, 0x7d -}; - -static const uint8_t AES_CBC_ciphertext_2048B[] = { - 0x8b, 0x55, 0xbd, 0xfd, 0x2b, 0x35, 0x76, 0x5c, - 0xd1, 0x90, 0xd7, 0x6a, 0x63, 0x1e, 0x39, 0x71, - 0x0d, 0x5c, 0xd8, 0x03, 0x00, 0x75, 0xf1, 0x07, - 0x03, 0x8d, 0x76, 0xeb, 0x3b, 0x00, 0x1e, 0x33, - 0x88, 0xfc, 0x8f, 0x08, 0x4d, 0x33, 0xf1, 0x3c, - 0xee, 0xd0, 0x5d, 0x19, 0x8b, 0x3c, 0x50, 0x86, - 0xfd, 0x8d, 0x58, 0x21, 0xb4, 0xae, 0x0f, 0x81, - 0xe9, 0x9f, 0xc9, 0xc0, 0x90, 0xf7, 0x04, 0x6f, - 0x39, 0x1d, 0x8a, 0x3f, 0x8d, 0x32, 0x23, 0xb5, - 0x1f, 0xcc, 0x8a, 0x12, 0x2d, 0x46, 0x82, 0x5e, - 0x6a, 0x34, 0x8c, 0xb1, 0x93, 0x70, 0x3b, 0xde, - 0x55, 0xaf, 0x16, 0x35, 0x99, 0x84, 0xd5, 0x88, - 0xc9, 0x54, 0xb1, 0xb2, 0xd3, 0xeb, 0x9e, 0x55, - 0x9a, 0xa9, 0xa7, 0xf5, 0xda, 0x29, 0xcf, 0xe1, - 0x98, 0x64, 0x45, 0x77, 0xf2, 0x12, 0x69, 0x8f, - 0x78, 0xd8, 0x82, 0x41, 0xb2, 0x9f, 0xe2, 0x1c, - 0x63, 0x9b, 0x24, 0x81, 0x67, 0x95, 0xa2, 0xff, - 0x26, 0x9d, 0x65, 0x48, 0x61, 0x30, 0x66, 0x41, - 0x68, 0x84, 0xbb, 0x59, 0x14, 0x8e, 0x9a, 0x62, - 0xb6, 0xca, 0xda, 0xbe, 0x7c, 0x41, 0x52, 0x6e, - 0x1b, 0x86, 0xbf, 0x08, 0xeb, 0x37, 0x84, 0x60, - 0xe4, 0xc4, 0x1e, 0xa8, 0x4c, 0x84, 0x60, 0x2f, - 0x70, 0x90, 0xf2, 0x26, 0xe7, 0x65, 0x0c, 0xc4, - 0x58, 0x36, 0x8e, 0x4d, 0xdf, 0xff, 0x9a, 0x39, - 0x93, 0x01, 0xcf, 0x6f, 0x6d, 0xde, 0xef, 0x79, - 0xb0, 0xce, 0xe2, 0x98, 0xdb, 0x85, 0x8d, 0x62, - 0x9d, 0xb9, 0x63, 0xfd, 0xf0, 0x35, 0xb5, 0xa9, - 0x1b, 0xf9, 0xe5, 0xd4, 0x2e, 0x22, 0x2d, 0xcc, - 0x42, 0xbf, 0x0e, 0x51, 0xf7, 0x15, 0x07, 0x32, - 0x75, 0x5b, 0x74, 0xbb, 0x00, 0xef, 0xd4, 0x66, - 0x8b, 0xad, 0x71, 0x53, 0x94, 0xd7, 0x7d, 0x2c, - 0x40, 0x3e, 0x69, 0xa0, 0x4c, 0x86, 0x5e, 0x06, - 0xed, 0xdf, 0x22, 0xe2, 0x24, 0x25, 0x4e, 0x9b, - 0x5f, 0x49, 0x74, 0xba, 0xed, 0xb1, 0xa6, 0xeb, - 0xae, 0x3f, 0xc6, 0x9e, 0x0b, 0x29, 0x28, 0x9a, - 0xb6, 0xb2, 0x74, 0x58, 0xec, 0xa6, 0x4a, 0xed, - 0xe5, 0x10, 0x00, 0x85, 0xe1, 0x63, 0x41, 0x61, - 0x30, 0x7c, 0x97, 0xcf, 0x75, 0xcf, 0xb6, 0xf3, - 0xf7, 0xda, 0x35, 0x3f, 0x85, 0x8c, 0x64, 0xca, - 0xb7, 0xea, 0x7f, 0xe4, 0xa3, 0x4d, 0x30, 0x84, - 0x8c, 0x9c, 0x80, 0x5a, 0x50, 0xa5, 0x64, 0xae, - 0x26, 0xd3, 0xb5, 0x01, 0x73, 0x36, 0x8a, 0x92, - 0x49, 0xc4, 0x1a, 0x94, 0x81, 0x9d, 0xf5, 0x6c, - 0x50, 0xe1, 0x58, 0x0b, 0x75, 0xdd, 0x6b, 0x6a, - 0xca, 0x69, 0xea, 0xc3, 0x33, 0x90, 0x9f, 0x3b, - 0x65, 0x5d, 0x5e, 0xee, 0x31, 0xb7, 0x32, 0xfd, - 0x56, 0x83, 0xb6, 0xfb, 0xa8, 0x04, 0xfc, 0x1e, - 0x11, 0xfb, 0x02, 0x23, 0x53, 0x49, 0x45, 0xb1, - 0x07, 0xfc, 0xba, 0xe7, 0x5f, 0x5d, 0x2d, 0x7f, - 0x9e, 0x46, 0xba, 0xe9, 0xb0, 0xdb, 0x32, 0x04, - 0xa4, 0xa7, 0x98, 0xab, 0x91, 0xcd, 0x02, 0x05, - 0xf5, 0x74, 0x31, 0x98, 0x83, 0x3d, 0x33, 0x11, - 0x0e, 0xe3, 0x8d, 0xa8, 0xc9, 0x0e, 0xf3, 0xb9, - 0x47, 0x67, 0xe9, 0x79, 0x2b, 0x34, 0xcd, 0x9b, - 0x45, 0x75, 0x29, 0xf0, 0xbf, 0xcc, 0xda, 0x3a, - 0x91, 0xb2, 0x15, 0x27, 0x7a, 0xe5, 0xf5, 0x6a, - 0x5e, 0xbe, 0x2c, 0x98, 0xe8, 0x40, 0x96, 0x4f, - 0x8a, 0x09, 0xfd, 0xf6, 0xb2, 0xe7, 0x45, 0xb6, - 0x08, 0xc1, 0x69, 0xe1, 0xb3, 0xc4, 0x24, 0x34, - 0x07, 0x85, 0xd5, 0xa9, 0x78, 0xca, 0xfa, 0x4b, - 0x01, 0x19, 0x4d, 0x95, 0xdc, 0xa5, 0xc1, 0x9c, - 0xec, 0x27, 0x5b, 0xa6, 0x54, 0x25, 0xbd, 0xc8, - 0x0a, 0xb7, 0x11, 0xfb, 0x4e, 0xeb, 0x65, 0x2e, - 0xe1, 0x08, 0x9c, 0x3a, 0x45, 0x44, 0x33, 0xef, - 0x0d, 0xb9, 0xff, 0x3e, 0x68, 0x9c, 0x61, 0x2b, - 0x11, 0xb8, 0x5c, 0x47, 0x0f, 0x94, 0xf2, 0xf8, - 0x0b, 0xbb, 0x99, 0x18, 0x85, 0xa3, 0xba, 0x44, - 0xf3, 0x79, 0xb3, 0x63, 0x2c, 0x1f, 0x2a, 0x35, - 0x3b, 0x23, 0x98, 0xab, 0xf4, 0x16, 0x36, 0xf8, - 0xde, 0x86, 0xa4, 0xd4, 0x75, 0xff, 0x51, 0xf9, - 0xeb, 0x42, 0x5f, 0x55, 0xe2, 0xbe, 0xd1, 0x5b, - 0xb5, 0x38, 0xeb, 0xb4, 0x4d, 0xec, 0xec, 0x99, - 0xe1, 0x39, 0x43, 0xaa, 0x64, 0xf7, 0xc9, 0xd8, - 0xf2, 0x9a, 0x71, 0x43, 0x39, 0x17, 0xe8, 0xa8, - 0xa2, 0xe2, 0xa4, 0x2c, 0x18, 0x11, 0x49, 0xdf, - 0x18, 0xdd, 0x85, 0x6e, 0x65, 0x96, 0xe2, 0xba, - 0xa1, 0x0a, 0x2c, 0xca, 0xdc, 0x5f, 0xe4, 0xf4, - 0x35, 0x03, 0xb2, 0xa9, 0xda, 0xcf, 0xb7, 0x6d, - 0x65, 0x82, 0x82, 0x67, 0x9d, 0x0e, 0xf3, 0xe8, - 0x85, 0x6c, 0x69, 0xb8, 0x4c, 0xa6, 0xc6, 0x2e, - 0x40, 0xb5, 0x54, 0x28, 0x95, 0xe4, 0x57, 0xe0, - 0x5b, 0xf8, 0xde, 0x59, 0xe0, 0xfd, 0x89, 0x48, - 0xac, 0x56, 0x13, 0x54, 0xb9, 0x1b, 0xf5, 0x59, - 0x97, 0xb6, 0xb3, 0xe8, 0xac, 0x2d, 0xfc, 0xd2, - 0xea, 0x57, 0x96, 0x57, 0xa8, 0x26, 0x97, 0x2c, - 0x01, 0x89, 0x56, 0xea, 0xec, 0x8c, 0x53, 0xd5, - 0xd7, 0x9e, 0xc9, 0x98, 0x0b, 0xad, 0x03, 0x75, - 0xa0, 0x6e, 0x98, 0x8b, 0x97, 0x8d, 0x8d, 0x85, - 0x7d, 0x74, 0xa7, 0x2d, 0xde, 0x67, 0x0c, 0xcd, - 0x54, 0xb8, 0x15, 0x7b, 0xeb, 0xf5, 0x84, 0xb9, - 0x78, 0xab, 0xd8, 0x68, 0x91, 0x1f, 0x6a, 0xa6, - 0x28, 0x22, 0xf7, 0x00, 0x49, 0x00, 0xbe, 0x41, - 0x71, 0x0a, 0xf5, 0xe7, 0x9f, 0xb4, 0x11, 0x41, - 0x3f, 0xcd, 0xa9, 0xa9, 0x01, 0x8b, 0x6a, 0xeb, - 0x54, 0x4c, 0x58, 0x92, 0x68, 0x02, 0x0e, 0xe9, - 0xed, 0x65, 0x4c, 0xfb, 0x95, 0x48, 0x58, 0xa2, - 0xaa, 0x57, 0x69, 0x13, 0x82, 0x0c, 0x2c, 0x4b, - 0x5d, 0x4e, 0x18, 0x30, 0xef, 0x1c, 0xb1, 0x9d, - 0x05, 0x05, 0x02, 0x1c, 0x97, 0xc9, 0x48, 0xfe, - 0x5e, 0x7b, 0x77, 0xa3, 0x1f, 0x2a, 0x81, 0x42, - 0xf0, 0x4b, 0x85, 0x12, 0x9c, 0x1f, 0x44, 0xb1, - 0x14, 0x91, 0x92, 0x65, 0x77, 0xb1, 0x87, 0xa2, - 0xfc, 0xa4, 0xe7, 0xd2, 0x9b, 0xf2, 0x17, 0xf0, - 0x30, 0x1c, 0x8d, 0x33, 0xbc, 0x25, 0x28, 0x48, - 0xfd, 0x30, 0x79, 0x0a, 0x99, 0x3e, 0xb4, 0x0f, - 0x1e, 0xa6, 0x68, 0x76, 0x19, 0x76, 0x29, 0xac, - 0x5d, 0xb8, 0x1e, 0x42, 0xd6, 0x85, 0x04, 0xbf, - 0x64, 0x1c, 0x2d, 0x53, 0xe9, 0x92, 0x78, 0xf8, - 0xc3, 0xda, 0x96, 0x92, 0x10, 0x6f, 0x45, 0x85, - 0xaf, 0x5e, 0xcc, 0xa8, 0xc0, 0xc6, 0x2e, 0x73, - 0x51, 0x3f, 0x5e, 0xd7, 0x52, 0x33, 0x71, 0x12, - 0x6d, 0x85, 0xee, 0xea, 0x85, 0xa8, 0x48, 0x2b, - 0x40, 0x64, 0x6d, 0x28, 0x73, 0x16, 0xd7, 0x82, - 0xd9, 0x90, 0xed, 0x1f, 0xa7, 0x5c, 0xb1, 0x5c, - 0x27, 0xb9, 0x67, 0x8b, 0xb4, 0x17, 0x13, 0x83, - 0x5f, 0x09, 0x72, 0x0a, 0xd7, 0xa0, 0xec, 0x81, - 0x59, 0x19, 0xb9, 0xa6, 0x5a, 0x37, 0x34, 0x14, - 0x47, 0xf6, 0xe7, 0x6c, 0xd2, 0x09, 0x10, 0xe7, - 0xdd, 0xbb, 0x02, 0xd1, 0x28, 0xfa, 0x01, 0x2c, - 0x93, 0x64, 0x2e, 0x1b, 0x4c, 0x02, 0x52, 0xcb, - 0x07, 0xa1, 0xb6, 0x46, 0x02, 0x80, 0xd9, 0x8f, - 0x5c, 0x62, 0xbe, 0x78, 0x9e, 0x75, 0xc4, 0x97, - 0x91, 0x39, 0x12, 0x65, 0xb9, 0x3b, 0xc2, 0xd1, - 0xaf, 0xf2, 0x1f, 0x4e, 0x4d, 0xd1, 0xf0, 0x9f, - 0xb7, 0x12, 0xfd, 0xe8, 0x75, 0x18, 0xc0, 0x9d, - 0x8c, 0x70, 0xff, 0x77, 0x05, 0xb6, 0x1a, 0x1f, - 0x96, 0x48, 0xf6, 0xfe, 0xd5, 0x5d, 0x98, 0xa5, - 0x72, 0x1c, 0x84, 0x76, 0x3e, 0xb8, 0x87, 0x37, - 0xdd, 0xd4, 0x3a, 0x45, 0xdd, 0x09, 0xd8, 0xe7, - 0x09, 0x2f, 0x3e, 0x33, 0x9e, 0x7b, 0x8c, 0xe4, - 0x85, 0x12, 0x4e, 0xf8, 0x06, 0xb7, 0xb1, 0x85, - 0x24, 0x96, 0xd8, 0xfe, 0x87, 0x92, 0x81, 0xb1, - 0xa3, 0x38, 0xb9, 0x56, 0xe1, 0xf6, 0x36, 0x41, - 0xbb, 0xd6, 0x56, 0x69, 0x94, 0x57, 0xb3, 0xa4, - 0xca, 0xa4, 0xe1, 0x02, 0x3b, 0x96, 0x71, 0xe0, - 0xb2, 0x2f, 0x85, 0x48, 0x1b, 0x4a, 0x41, 0x80, - 0x4b, 0x9c, 0xe0, 0xc9, 0x39, 0xb8, 0xb1, 0xca, - 0x64, 0x77, 0x46, 0x58, 0xe6, 0x84, 0xd5, 0x2b, - 0x65, 0xce, 0xe9, 0x09, 0xa3, 0xaa, 0xfb, 0x83, - 0xa9, 0x28, 0x68, 0xfd, 0xcd, 0xfd, 0x76, 0x83, - 0xe1, 0x20, 0x22, 0x77, 0x3a, 0xa3, 0xb2, 0x93, - 0x14, 0x91, 0xfc, 0xe2, 0x17, 0x63, 0x2b, 0xa6, - 0x29, 0x38, 0x7b, 0x9b, 0x8b, 0x15, 0x77, 0xd6, - 0xaa, 0x92, 0x51, 0x53, 0x50, 0xff, 0xa0, 0x35, - 0xa0, 0x59, 0x7d, 0xf0, 0x11, 0x23, 0x49, 0xdf, - 0x5a, 0x21, 0xc2, 0xfe, 0x35, 0xa0, 0x1d, 0xe2, - 0xae, 0xa2, 0x8a, 0x61, 0x5b, 0xf7, 0xf1, 0x1c, - 0x1c, 0xec, 0xc4, 0xf6, 0xdc, 0xaa, 0xc8, 0xc2, - 0xe5, 0xa1, 0x2e, 0x14, 0xe5, 0xc6, 0xc9, 0x73, - 0x03, 0x78, 0xeb, 0xed, 0xe0, 0x3e, 0xc5, 0xf4, - 0xf1, 0x50, 0xb2, 0x01, 0x91, 0x96, 0xf5, 0xbb, - 0xe1, 0x32, 0xcd, 0xa8, 0x66, 0xbf, 0x73, 0x85, - 0x94, 0xd6, 0x7e, 0x68, 0xc5, 0xe4, 0xed, 0xd5, - 0xe3, 0x67, 0x4c, 0xa5, 0xb3, 0x1f, 0xdf, 0xf8, - 0xb3, 0x73, 0x5a, 0xac, 0xeb, 0x46, 0x16, 0x24, - 0xab, 0xca, 0xa4, 0xdd, 0x87, 0x0e, 0x24, 0x83, - 0x32, 0x04, 0x4c, 0xd8, 0xda, 0x7d, 0xdc, 0xe3, - 0x01, 0x93, 0xf3, 0xc1, 0x5b, 0xbd, 0xc3, 0x1d, - 0x40, 0x62, 0xde, 0x94, 0x03, 0x85, 0x91, 0x2a, - 0xa0, 0x25, 0x10, 0xd3, 0x32, 0x9f, 0x93, 0x00, - 0xa7, 0x8a, 0xfa, 0x77, 0x7c, 0xaf, 0x4d, 0xc8, - 0x7a, 0xf3, 0x16, 0x2b, 0xba, 0xeb, 0x74, 0x51, - 0xb8, 0xdd, 0x32, 0xad, 0x68, 0x7d, 0xdd, 0xca, - 0x60, 0x98, 0xc9, 0x9b, 0xb6, 0x5d, 0x4d, 0x3a, - 0x66, 0x8a, 0xbe, 0x05, 0xf9, 0x0c, 0xc5, 0xba, - 0x52, 0x82, 0x09, 0x1f, 0x5a, 0x66, 0x89, 0x69, - 0xa3, 0x5d, 0x93, 0x50, 0x7d, 0x44, 0xc3, 0x2a, - 0xb8, 0xab, 0xec, 0xa6, 0x5a, 0xae, 0x4a, 0x6a, - 0xcd, 0xfd, 0xb6, 0xff, 0x3d, 0x98, 0x05, 0xd9, - 0x5b, 0x29, 0xc4, 0x6f, 0xe0, 0x76, 0xe2, 0x3f, - 0xec, 0xd7, 0xa4, 0x91, 0x63, 0xf5, 0x4e, 0x4b, - 0xab, 0x20, 0x8c, 0x3a, 0x41, 0xed, 0x8b, 0x4b, - 0xb9, 0x01, 0x21, 0xc0, 0x6d, 0xfd, 0x70, 0x5b, - 0x20, 0x92, 0x41, 0x89, 0x74, 0xb7, 0xe9, 0x8b, - 0xfc, 0x6d, 0x17, 0x3f, 0x7f, 0x89, 0x3d, 0x6b, - 0x8f, 0xbc, 0xd2, 0x57, 0xe9, 0xc9, 0x6e, 0xa7, - 0x19, 0x26, 0x18, 0xad, 0xef, 0xb5, 0x87, 0xbf, - 0xb8, 0xa8, 0xd6, 0x7d, 0xdd, 0x5f, 0x94, 0x54, - 0x09, 0x92, 0x2b, 0xf5, 0x04, 0xf7, 0x36, 0x69, - 0x8e, 0xf4, 0xdc, 0x1d, 0x6e, 0x55, 0xbb, 0xe9, - 0x13, 0x05, 0x83, 0x35, 0x9c, 0xed, 0xcf, 0x8c, - 0x26, 0x8c, 0x7b, 0xc7, 0x0b, 0xba, 0xfd, 0xe2, - 0x84, 0x5c, 0x2a, 0x79, 0x43, 0x99, 0xb2, 0xc3, - 0x82, 0x87, 0xc8, 0xcd, 0x37, 0x6d, 0xa1, 0x2b, - 0x39, 0xb2, 0x38, 0x99, 0xd9, 0xfc, 0x02, 0x15, - 0x55, 0x21, 0x62, 0x59, 0xeb, 0x00, 0x86, 0x08, - 0x20, 0xbe, 0x1a, 0x62, 0x4d, 0x7e, 0xdf, 0x68, - 0x73, 0x5b, 0x5f, 0xaf, 0x84, 0x96, 0x2e, 0x1f, - 0x6b, 0x03, 0xc9, 0xa6, 0x75, 0x18, 0xe9, 0xd4, - 0xbd, 0xc8, 0xec, 0x9a, 0x5a, 0xb3, 0x99, 0xab, - 0x5f, 0x7c, 0x08, 0x7f, 0x69, 0x4d, 0x52, 0xa2, - 0x30, 0x17, 0x3b, 0x16, 0x15, 0x1b, 0x11, 0x62, - 0x3e, 0x80, 0x4b, 0x85, 0x7c, 0x9c, 0xd1, 0x3a, - 0x13, 0x01, 0x5e, 0x45, 0xf1, 0xc8, 0x5f, 0xcd, - 0x0e, 0x21, 0xf5, 0x82, 0xd4, 0x7b, 0x5c, 0x45, - 0x27, 0x6b, 0xef, 0xfe, 0xb8, 0xc0, 0x6f, 0xdc, - 0x60, 0x7b, 0xe4, 0xd5, 0x75, 0x71, 0xe6, 0xe8, - 0x7d, 0x6b, 0x6d, 0x80, 0xaf, 0x76, 0x41, 0x58, - 0xb7, 0xac, 0xb7, 0x13, 0x2f, 0x81, 0xcc, 0xf9, - 0x19, 0x97, 0xe8, 0xee, 0x40, 0x91, 0xfc, 0x89, - 0x13, 0x1e, 0x67, 0x9a, 0xdb, 0x8f, 0x8f, 0xc7, - 0x4a, 0xc9, 0xaf, 0x2f, 0x67, 0x01, 0x3c, 0xb8, - 0xa8, 0x3e, 0x78, 0x93, 0x1b, 0xdf, 0xbb, 0x34, - 0x0b, 0x1a, 0xfa, 0xc2, 0x2d, 0xc5, 0x1c, 0xec, - 0x97, 0x4f, 0x48, 0x41, 0x15, 0x0e, 0x75, 0xed, - 0x66, 0x8c, 0x17, 0x7f, 0xb1, 0x48, 0x13, 0xc1, - 0xfb, 0x60, 0x06, 0xf9, 0x72, 0x41, 0x3e, 0xcf, - 0x6e, 0xb6, 0xc8, 0xeb, 0x4b, 0x5a, 0xd2, 0x0c, - 0x28, 0xda, 0x02, 0x7a, 0x46, 0x21, 0x42, 0xb5, - 0x34, 0xda, 0xcb, 0x5e, 0xbd, 0x66, 0x5c, 0xca, - 0xff, 0x52, 0x43, 0x89, 0xf9, 0x10, 0x9a, 0x9e, - 0x9b, 0xe3, 0xb0, 0x51, 0xe9, 0xf3, 0x0a, 0x35, - 0x77, 0x54, 0xcc, 0xac, 0xa6, 0xf1, 0x2e, 0x36, - 0x89, 0xac, 0xc5, 0xc6, 0x62, 0x5a, 0xc0, 0x6d, - 0xc4, 0xe1, 0xf7, 0x64, 0x30, 0xff, 0x11, 0x40, - 0x13, 0x89, 0xd8, 0xd7, 0x73, 0x3f, 0x93, 0x08, - 0x68, 0xab, 0x66, 0x09, 0x1a, 0xea, 0x78, 0xc9, - 0x52, 0xf2, 0xfd, 0x93, 0x1b, 0x94, 0xbe, 0x5c, - 0xe5, 0x00, 0x6e, 0x00, 0xb9, 0xea, 0x27, 0xaa, - 0xb3, 0xee, 0xe3, 0xc8, 0x6a, 0xb0, 0xc1, 0x8e, - 0x9b, 0x54, 0x40, 0x10, 0x96, 0x06, 0xe8, 0xb3, - 0xf5, 0x55, 0x77, 0xd7, 0x5c, 0x94, 0xc1, 0x74, - 0xf3, 0x07, 0x64, 0xac, 0x1c, 0xde, 0xc7, 0x22, - 0xb0, 0xbf, 0x2a, 0x5a, 0xc0, 0x8f, 0x8a, 0x83, - 0x50, 0xc2, 0x5e, 0x97, 0xa0, 0xbe, 0x49, 0x7e, - 0x47, 0xaf, 0xa7, 0x20, 0x02, 0x35, 0xa4, 0x57, - 0xd9, 0x26, 0x63, 0xdb, 0xf1, 0x34, 0x42, 0x89, - 0x36, 0xd1, 0x77, 0x6f, 0xb1, 0xea, 0x79, 0x7e, - 0x95, 0x10, 0x5a, 0xee, 0xa3, 0xae, 0x6f, 0xba, - 0xa9, 0xef, 0x5a, 0x7e, 0x34, 0x03, 0x04, 0x07, - 0x92, 0xd6, 0x07, 0x79, 0xaa, 0x14, 0x90, 0x97, - 0x05, 0x4d, 0xa6, 0x27, 0x10, 0x5c, 0x25, 0x24, - 0xcb, 0xcc, 0xf6, 0x77, 0x9e, 0x43, 0x23, 0xd4, - 0x98, 0xef, 0x22, 0xa8, 0xad, 0xf2, 0x26, 0x08, - 0x59, 0x69, 0xa4, 0xc3, 0x97, 0xe0, 0x5c, 0x6f, - 0xeb, 0x3d, 0xd4, 0x62, 0x6e, 0x80, 0x61, 0x02, - 0xf4, 0xfc, 0x94, 0x79, 0xbb, 0x4e, 0x6d, 0xd7, - 0x30, 0x5b, 0x10, 0x11, 0x5a, 0x3d, 0xa7, 0x50, - 0x1d, 0x9a, 0x13, 0x5f, 0x4f, 0xa8, 0xa7, 0xb6, - 0x39, 0xc7, 0xea, 0xe6, 0x19, 0x61, 0x69, 0xc7, - 0x9a, 0x3a, 0xeb, 0x9d, 0xdc, 0xf7, 0x06, 0x37, - 0xbd, 0xac, 0xe3, 0x18, 0xff, 0xfe, 0x11, 0xdb, - 0x67, 0x42, 0xb4, 0xea, 0xa8, 0xbd, 0xb0, 0x76, - 0xd2, 0x74, 0x32, 0xc2, 0xa4, 0x9c, 0xe7, 0x60, - 0xc5, 0x30, 0x9a, 0x57, 0x66, 0xcd, 0x0f, 0x02, - 0x4c, 0xea, 0xe9, 0xd3, 0x2a, 0x5c, 0x09, 0xc2, - 0xff, 0x6a, 0xde, 0x5d, 0xb7, 0xe9, 0x75, 0x6b, - 0x29, 0x94, 0xd6, 0xf7, 0xc3, 0xdf, 0xfb, 0x70, - 0xec, 0xb5, 0x8c, 0xb0, 0x78, 0x7a, 0xee, 0x52, - 0x5f, 0x8c, 0xae, 0x85, 0xe5, 0x98, 0xa2, 0xb7, - 0x7c, 0x02, 0x2a, 0xcc, 0x9e, 0xde, 0x99, 0x5f, - 0x84, 0x20, 0xbb, 0xdc, 0xf2, 0xd2, 0x13, 0x46, - 0x3c, 0xd6, 0x4d, 0xe7, 0x50, 0xef, 0x55, 0xc3, - 0x96, 0x9f, 0xec, 0x6c, 0xd8, 0xe2, 0xea, 0xed, - 0xc7, 0x33, 0xc9, 0xb3, 0x1c, 0x4f, 0x1d, 0x83, - 0x1d, 0xe4, 0xdd, 0xb2, 0x24, 0x8f, 0xf9, 0xf5 -}; - - -static const uint8_t HMAC_SHA256_ciphertext_64B_digest[] = { - 0xc5, 0x6d, 0x4f, 0x29, 0xf4, 0xd2, 0xcc, 0x87, - 0x3c, 0x81, 0x02, 0x6d, 0x38, 0x7a, 0x67, 0x3e, - 0x95, 0x9c, 0x5c, 0x8f, 0xda, 0x5c, 0x06, 0xe0, - 0x65, 0xf1, 0x6c, 0x51, 0x52, 0x49, 0x3e, 0x5f -}; - -static const uint8_t HMAC_SHA256_ciphertext_128B_digest[] = { - 0x76, 0x64, 0x2d, 0x69, 0x71, 0x5d, 0x6a, 0xd8, - 0x9f, 0x74, 0x11, 0x2f, 0x58, 0xe0, 0x4a, 0x2f, - 0x6c, 0x88, 0x5e, 0x4d, 0x9c, 0x79, 0x83, 0x1c, - 0x8a, 0x14, 0xd0, 0x07, 0xfb, 0xbf, 0x6c, 0x8f -}; - -static const uint8_t HMAC_SHA256_ciphertext_256B_digest[] = { - 0x05, 0xa7, 0x44, 0xcd, 0x91, 0x8c, 0x95, 0xcf, - 0x7b, 0x8f, 0xd3, 0x90, 0x86, 0x7e, 0x7b, 0xb9, - 0x05, 0xd6, 0x6e, 0x7a, 0xc1, 0x7b, 0x26, 0xff, - 0xd3, 0x4b, 0xe0, 0x22, 0x8b, 0xa8, 0x47, 0x52 -}; - -static const uint8_t HMAC_SHA256_ciphertext_512B_digest[] = { - 0x08, 0xb7, 0x29, 0x54, 0x18, 0x7e, 0x97, 0x49, - 0xc6, 0x7c, 0x9f, 0x94, 0xa5, 0x4f, 0xa2, 0x25, - 0xd0, 0xe2, 0x30, 0x7b, 0xad, 0x93, 0xc9, 0x12, - 0x0f, 0xf0, 0xf0, 0x71, 0xc2, 0xf6, 0x53, 0x8f -}; - -static const uint8_t HMAC_SHA256_ciphertext_768B_digest[] = { - 0xe4, 0x3e, 0x73, 0x93, 0x03, 0xaf, 0x6f, 0x9c, - 0xca, 0x57, 0x3b, 0x4a, 0x6e, 0x83, 0x58, 0xf5, - 0x66, 0xc2, 0xb4, 0xa7, 0xe0, 0xee, 0x63, 0x6b, - 0x48, 0xb7, 0x50, 0x45, 0x69, 0xdf, 0x5c, 0x5b -}; - -static const uint8_t HMAC_SHA256_ciphertext_1024B_digest[] = { - 0x03, 0xb9, 0x96, 0x26, 0xdc, 0x1c, 0xab, 0xe2, - 0xf5, 0x70, 0x55, 0x15, 0x67, 0x6e, 0x48, 0x11, - 0xe7, 0x67, 0xea, 0xfa, 0x5c, 0x6b, 0x28, 0x22, - 0xc9, 0x0e, 0x67, 0x04, 0xb3, 0x71, 0x7f, 0x88 -}; - -static const uint8_t HMAC_SHA256_ciphertext_1280B_digest[] = { - 0x01, 0x91, 0xb8, 0x78, 0xd3, 0x21, 0x74, 0xa5, - 0x1c, 0x8b, 0xd4, 0xd2, 0xc0, 0x49, 0xd7, 0xd2, - 0x16, 0x46, 0x66, 0x85, 0x50, 0x6d, 0x08, 0xcc, - 0xc7, 0x0a, 0xa3, 0x71, 0xcc, 0xde, 0xee, 0xdc -}; - -static const uint8_t HMAC_SHA256_ciphertext_1536B_digest[] = { - 0xf2, 0xe5, 0xe9, 0x57, 0x53, 0xd7, 0x69, 0x28, - 0x7b, 0x69, 0xb5, 0x49, 0xa3, 0x31, 0x56, 0x5f, - 0xa4, 0xe9, 0x87, 0x26, 0x2f, 0xe0, 0x2d, 0xd6, - 0x08, 0x44, 0x01, 0x71, 0x0c, 0x93, 0x85, 0x84 -}; - -static const uint8_t HMAC_SHA256_ciphertext_1792B_digest[] = { - 0xf6, 0x57, 0x62, 0x01, 0xbf, 0x2d, 0xea, 0x4a, - 0xef, 0x43, 0x85, 0x60, 0x18, 0xdf, 0x8b, 0xb4, - 0x60, 0xc0, 0xfd, 0x2f, 0x90, 0x15, 0xe6, 0x91, - 0x56, 0x61, 0x68, 0x7f, 0x5e, 0x92, 0xa8, 0xdd -}; - -static const uint8_t HMAC_SHA256_ciphertext_2048B_digest[] = { - 0x81, 0x1a, 0x29, 0xbc, 0x6b, 0x9f, 0xbb, 0xb8, - 0xef, 0x71, 0x7b, 0x1f, 0x6f, 0xd4, 0x7e, 0x68, - 0x3a, 0x9c, 0xb9, 0x98, 0x22, 0x81, 0xfa, 0x95, - 0xee, 0xbc, 0x7f, 0x23, 0x29, 0x88, 0x76, 0xb8 -}; - -struct crypto_data_params { - const char *name; - uint16_t length; - const char *plaintext; - struct crypto_expected_output { - const uint8_t *ciphertext; - const uint8_t *digest; - } expected; -}; - -#define MAX_PACKET_SIZE_INDEX 10 - -struct crypto_data_params aes_cbc_hmac_sha256_output[MAX_PACKET_SIZE_INDEX] = { - { "64B", 64, &plaintext_quote[sizeof(plaintext_quote) - 1 - 64], - { AES_CBC_ciphertext_64B, HMAC_SHA256_ciphertext_64B_digest } }, - { "128B", 128, &plaintext_quote[sizeof(plaintext_quote) - 1 - 128], - { AES_CBC_ciphertext_128B, HMAC_SHA256_ciphertext_128B_digest } }, - { "256B", 256, &plaintext_quote[sizeof(plaintext_quote) - 1 - 256], - { AES_CBC_ciphertext_256B, HMAC_SHA256_ciphertext_256B_digest } }, - { "512B", 512, &plaintext_quote[sizeof(plaintext_quote) - 1 - 512], - { AES_CBC_ciphertext_512B, HMAC_SHA256_ciphertext_512B_digest } }, - { "768B", 768, &plaintext_quote[sizeof(plaintext_quote) - 1 - 768], - { AES_CBC_ciphertext_768B, HMAC_SHA256_ciphertext_768B_digest } }, - { "1024B", 1024, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1024], - { AES_CBC_ciphertext_1024B, HMAC_SHA256_ciphertext_1024B_digest } }, - { "1280B", 1280, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1280], - { AES_CBC_ciphertext_1280B, HMAC_SHA256_ciphertext_1280B_digest } }, - { "1536B", 1536, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1536], - { AES_CBC_ciphertext_1536B, HMAC_SHA256_ciphertext_1536B_digest } }, - { "1792B", 1792, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1792], - { AES_CBC_ciphertext_1792B, HMAC_SHA256_ciphertext_1792B_digest } }, - { "2048B", 2048, &plaintext_quote[sizeof(plaintext_quote) - 1 - 2048], - { AES_CBC_ciphertext_2048B, HMAC_SHA256_ciphertext_2048B_digest } } -}; - -static int -test_perf_crypto_qp_vary_burst_size(uint16_t dev_num) -{ - uint32_t num_to_submit = 4096; - struct rte_crypto_op *c_ops[num_to_submit]; - struct rte_crypto_op *proc_ops[num_to_submit]; - uint64_t failed_polls, retries, start_cycles, end_cycles, total_cycles = 0; - uint32_t burst_sent, burst_received; - uint32_t i, burst_size, num_sent, num_received; - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct crypto_unittest_params *ut_params = &unittest_params; - struct crypto_data_params *data_params = aes_cbc_hmac_sha256_output; - - if (rte_cryptodev_count() == 0) { - printf("\nNo crypto devices available. Is kernel driver loaded?\n"); - return TEST_FAILED; - } - - /* Setup Cipher Parameters */ - ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.next = &ut_params->auth_xform; - - ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; - ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT; - ut_params->cipher_xform.cipher.key.data = aes_cbc_128_key; - ut_params->cipher_xform.cipher.key.length = CIPHER_IV_LENGTH_AES_CBC; - ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET; - ut_params->cipher_xform.cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; - - /* Setup HMAC Parameters */ - ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - ut_params->auth_xform.next = NULL; - - ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; - ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA256_HMAC; - ut_params->auth_xform.auth.key.data = hmac_sha256_key; - ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA256; - ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA256; - - /* Create Crypto session*/ - - test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp); - - rte_cryptodev_sym_session_init(ts_params->dev_id, test_crypto_session, - &ut_params->cipher_xform, ts_params->sess_mp); - - TEST_ASSERT_NOT_NULL(test_crypto_session, "Session creation failed"); - - /* Generate Crypto op data structure(s) */ - for (i = 0; i < num_to_submit ; i++) { - struct rte_mbuf *m = setup_test_string(ts_params->mbuf_mp, - data_params[0].expected.ciphertext, - data_params[0].length, 0); - TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf"); - - ut_params->digest = (uint8_t *)rte_pktmbuf_append(m, - DIGEST_BYTE_LENGTH_SHA256); - TEST_ASSERT_NOT_NULL(ut_params->digest, - "no room to append digest"); - - rte_memcpy(ut_params->digest, data_params[0].expected.digest, - DIGEST_BYTE_LENGTH_SHA256); - - - struct rte_crypto_op *op = - rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - - rte_crypto_op_attach_sym_session(op, test_crypto_session); - - op->sym->auth.digest.data = ut_params->digest; - op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m, - data_params[0].length); - - op->sym->auth.data.offset = 0; - op->sym->auth.data.length = data_params[0].length; - - rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET), - aes_cbc_128_iv, CIPHER_IV_LENGTH_AES_CBC); - - op->sym->cipher.data.offset = 0; - op->sym->cipher.data.length = data_params[0].length; - - op->sym->m_src = m; - - c_ops[i] = op; - } - - printf("\nTest to measure the IA cycle cost using AES128_CBC_SHA256_HMAC " - "algorithm with a constant request size of %u.", - data_params[0].length); - printf("\nThis test will keep retries at 0 and only measure IA cycle " - "cost for each request."); - printf("\nDev No\tQP No\tNum Sent\tNum Received\tTx/Rx burst"); - printf("\tRetries (Device Busy)\tAverage IA cycle cost " - "(assuming 0 retries)"); - for (i = 2; i <= 128 ; i *= 2) { - num_sent = 0; - num_received = 0; - retries = 0; - failed_polls = 0; - burst_size = i; - total_cycles = 0; - while (num_sent < num_to_submit) { - start_cycles = rte_rdtsc_precise(); - burst_sent = rte_cryptodev_enqueue_burst(dev_num, - 0, &c_ops[num_sent], - ((num_to_submit-num_sent) < burst_size) ? - num_to_submit-num_sent : burst_size); - if (burst_sent == 0) - retries++; - else - num_sent += burst_sent; - end_cycles = rte_rdtsc_precise(); - total_cycles += (end_cycles - start_cycles); - /* - * Wait until requests have been sent. - */ - rte_delay_ms(1); - - start_cycles = rte_rdtsc_precise(); - burst_received = rte_cryptodev_dequeue_burst( - dev_num, 0, proc_ops, burst_size); - if (burst_received == 0) - failed_polls++; - else - num_received += burst_received; - end_cycles = rte_rdtsc_precise(); - total_cycles += end_cycles - start_cycles; - } - - while (num_received != num_to_submit) { - if (gbl_driver_id == - rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) - rte_cryptodev_enqueue_burst(dev_num, 0, - NULL, 0); - - burst_received = rte_cryptodev_dequeue_burst( - dev_num, 0, proc_ops, burst_size); - if (burst_received == 0) - failed_polls++; - else - num_received += burst_received; - } - - printf("\n%u\t%u\t%u\t\t%u\t\t%u", dev_num, 0, - num_sent, num_received, burst_size); - printf("\t\t%"PRIu64, retries); - printf("\t\t\t%"PRIu64, total_cycles/num_received); - } - printf("\n"); - - for (i = 0; i < num_to_submit ; i++) { - rte_pktmbuf_free(c_ops[i]->sym->m_src); - rte_crypto_op_free(c_ops[i]); - } - return TEST_SUCCESS; -} - -static int -test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams) -{ - uint32_t num_to_submit = pparams->total_operations; - struct rte_crypto_op *c_ops[num_to_submit]; - struct rte_crypto_op *proc_ops[num_to_submit]; - uint64_t failed_polls, retries, start_cycles, end_cycles, total_cycles = 0; - uint32_t burst_sent = 0, burst_received = 0; - uint32_t i, burst_size, num_sent, num_ops_received; - struct crypto_testsuite_params *ts_params = &testsuite_params; - static struct rte_cryptodev_sym_session *sess; - - if (rte_cryptodev_count() == 0) { - printf("\nNo crypto devices found. Is PMD build configured?\n"); - printf("\nAnd is kernel driver loaded for HW PMDs?\n"); - return TEST_FAILED; - } - - /* Create Crypto session*/ - if (test_perf_create_snow3g_session(ts_params->dev_id, - pparams->chain, pparams->cipher_algo, - pparams->key_length, pparams->auth_algo) == 0) - sess = test_crypto_session; - else - sess = NULL; - TEST_ASSERT_NOT_NULL(sess, "Session creation failed"); - - /* Generate Crypto op data structure(s)*/ - for (i = 0; i < num_to_submit ; i++) { - struct rte_mbuf *m = test_perf_create_pktmbuf( - ts_params->mbuf_mp, - pparams->buf_size); - TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf"); - - struct rte_crypto_op *op = - rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(op, "Failed to allocate op"); - - op = test_perf_set_crypto_op_snow3g(op, m, sess, pparams->buf_size); - TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session"); - - c_ops[i] = op; - } - - if (pparams->chain == AEAD) - printf("\nOn %s dev%u qp%u, %s, aead algo:%s, " - "Packet Size %u bytes", - pmd_name(gbl_driver_id), - ts_params->dev_id, 0, - chain_mode_name(pparams->chain), - rte_crypto_aead_algorithm_strings[pparams->aead_algo], - pparams->buf_size); - else - printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, auth_algo:%s, " - "Packet Size %u bytes", - pmd_name(gbl_driver_id), - ts_params->dev_id, 0, - chain_mode_name(pparams->chain), - rte_crypto_cipher_algorithm_strings[pparams->cipher_algo], - rte_crypto_auth_algorithm_strings[pparams->auth_algo], - pparams->buf_size); - printf("\nOps Tx\tOps Rx\tOps/burst "); - printf("Retries EmptyPolls\tIACycles/CyOp\tIACycles/Burst\tIACycles/Byte"); - - for (i = 2; i <= 128 ; i *= 2) { - num_sent = 0; - num_ops_received = 0; - retries = 0; - failed_polls = 0; - burst_size = i; - total_cycles = 0; - while (num_sent < num_to_submit) { - start_cycles = rte_rdtsc_precise(); - burst_sent = rte_cryptodev_enqueue_burst(ts_params->dev_id, - 0, &c_ops[num_sent], - ((num_to_submit-num_sent) < burst_size) ? - num_to_submit-num_sent : burst_size); - end_cycles = rte_rdtsc_precise(); - if (burst_sent == 0) - retries++; - num_sent += burst_sent; - total_cycles += (end_cycles - start_cycles); - - /* Wait until requests have been sent. */ - - rte_delay_ms(1); - - start_cycles = rte_rdtsc_precise(); - burst_received = rte_cryptodev_dequeue_burst( - ts_params->dev_id, 0, proc_ops, burst_size); - end_cycles = rte_rdtsc_precise(); - if (burst_received < burst_sent) - failed_polls++; - num_ops_received += burst_received; - - total_cycles += end_cycles - start_cycles; - } - - while (num_ops_received != num_to_submit) { - if (gbl_driver_id == - rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) - rte_cryptodev_enqueue_burst(ts_params->dev_id, 0, - NULL, 0); - start_cycles = rte_rdtsc_precise(); - burst_received = rte_cryptodev_dequeue_burst( - ts_params->dev_id, 0, proc_ops, burst_size); - end_cycles = rte_rdtsc_precise(); - total_cycles += end_cycles - start_cycles; - if (burst_received == 0) - failed_polls++; - num_ops_received += burst_received; - } - - printf("\n%u\t%u\t%u", num_sent, num_ops_received, burst_size); - printf("\t\t%"PRIu64, retries); - printf("\t%"PRIu64, failed_polls); - printf("\t\t%"PRIu64, total_cycles/num_ops_received); - printf("\t\t%"PRIu64, (total_cycles/num_ops_received)*burst_size); - printf("\t\t%"PRIu64, total_cycles/(num_ops_received*pparams->buf_size)); - } - printf("\n"); - - for (i = 0; i < num_to_submit ; i++) { - rte_pktmbuf_free(c_ops[i]->sym->m_src); - rte_crypto_op_free(c_ops[i]); - } - - rte_cryptodev_sym_session_clear(ts_params->dev_id, - sess); - rte_cryptodev_sym_session_free(sess); - - return TEST_SUCCESS; -} - -static int -test_perf_snow3G_vary_burst_size(void) -{ - unsigned total_operations = 4096; - /*no need to vary pkt size for QAT, should have no effect on IA cycles */ - uint16_t buf_lengths[] = {40}; - uint8_t i, j; - - struct perf_test_params params_set[] = { - { - .chain = CIPHER_ONLY, - .cipher_algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_NULL, - }, - { - .chain = HASH_ONLY, - .cipher_algo = RTE_CRYPTO_CIPHER_NULL, - .auth_algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2, - .key_length = 16 - }, - }; - - printf("\n\nStart %s.", __func__); - printf("\nThis Test measures the average IA cycle cost using a " - "constant request(packet) size. "); - printf("Cycle cost is only valid when indicators show device is not busy," - " i.e. Retries and EmptyPolls = 0"); - - for (i = 0; i < RTE_DIM(params_set); i++) { - printf("\n"); - params_set[i].total_operations = total_operations; - - for (j = 0; - j < RTE_DIM(buf_lengths); - j++) { - - params_set[i].buf_size = buf_lengths[j]; - - test_perf_snow3G_optimise_cyclecount(¶ms_set[i]); - } - - } - - return 0; -} - -static int -test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams) -{ - uint32_t num_to_submit = pparams->total_operations; - struct rte_crypto_op *c_ops[num_to_submit]; - struct rte_crypto_op *proc_ops[num_to_submit]; - uint64_t failed_polls, retries, start_cycles, - end_cycles, total_cycles = 0; - uint32_t burst_sent = 0, burst_received = 0; - uint32_t i, burst_size, num_sent, num_ops_received; - - struct crypto_testsuite_params *ts_params = &testsuite_params; - - static struct rte_cryptodev_sym_session *sess; - - static struct rte_crypto_op *(*test_perf_set_crypto_op) - (struct rte_crypto_op *, struct rte_mbuf *, - struct rte_cryptodev_sym_session *, - unsigned int, - enum chain_mode); - - if (rte_cryptodev_count() == 0) { - printf("\nNo crypto devices found. Is PMD build configured?\n"); - return TEST_FAILED; - } - - /* Create Crypto session*/ - if (test_perf_create_openssl_session(ts_params->dev_id, - pparams->chain, pparams->cipher_algo, - pparams->key_length, pparams->auth_algo, - pparams->aead_algo) == 0) - sess = test_crypto_session; - else - sess = NULL; - TEST_ASSERT_NOT_NULL(sess, "Session creation failed"); - - /* Generate Crypto op data structure(s)*/ - for (i = 0; i < num_to_submit ; i++) { - struct rte_mbuf *m = test_perf_create_pktmbuf( - ts_params->mbuf_mp, - pparams->buf_size); - TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf"); - - struct rte_crypto_op *op = - rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(op, "Failed to allocate op"); - - if (pparams->chain == AEAD) - test_perf_set_crypto_op = - test_perf_set_crypto_op_aes_gcm; - else { - switch (pparams->cipher_algo) { - case RTE_CRYPTO_CIPHER_3DES_CBC: - case RTE_CRYPTO_CIPHER_3DES_CTR: - test_perf_set_crypto_op = test_perf_set_crypto_op_3des; - break; - case RTE_CRYPTO_CIPHER_AES_CBC: - case RTE_CRYPTO_CIPHER_AES_CTR: - test_perf_set_crypto_op = test_perf_set_crypto_op_aes; - break; - default: - return TEST_FAILED; - } - } - - op = test_perf_set_crypto_op(op, m, sess, pparams->buf_size, - pparams->chain); - TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session"); - - c_ops[i] = op; - } - - if (pparams->chain == AEAD) - printf("\nOn %s dev%u qp%u, %s, aead_algo:%s, " - "key length:%u, Packet Size %u bytes", - pmd_name(gbl_driver_id), - ts_params->dev_id, 0, - chain_mode_name(pparams->chain), - rte_crypto_aead_algorithm_strings[pparams->aead_algo], - pparams->key_length, - pparams->buf_size); - else - printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, auth_algo:%s, " - "key length:%u, Packet Size %u bytes", - pmd_name(gbl_driver_id), - ts_params->dev_id, 0, - chain_mode_name(pparams->chain), - rte_crypto_cipher_algorithm_strings[pparams->cipher_algo], - rte_crypto_auth_algorithm_strings[pparams->auth_algo], - pparams->key_length, - pparams->buf_size); - printf("\nOps Tx\tOps Rx\tOps/burst "); - printf("Retries EmptyPolls\tIACycles/CyOp\tIACycles/Burst\t" - "IACycles/Byte"); - - for (i = 2; i <= 128 ; i *= 2) { - num_sent = 0; - num_ops_received = 0; - retries = 0; - failed_polls = 0; - burst_size = i; - total_cycles = 0; - while (num_sent < num_to_submit) { - start_cycles = rte_rdtsc_precise(); - burst_sent = rte_cryptodev_enqueue_burst( - ts_params->dev_id, - 0, &c_ops[num_sent], - ((num_to_submit - num_sent) < - burst_size) ? - num_to_submit - num_sent : burst_size); - end_cycles = rte_rdtsc_precise(); - if (burst_sent == 0) - retries++; - num_sent += burst_sent; - total_cycles += (end_cycles - start_cycles); - - /* Wait until requests have been sent. */ - rte_delay_ms(1); - - start_cycles = rte_rdtsc_precise(); - burst_received = rte_cryptodev_dequeue_burst( - ts_params->dev_id, 0, proc_ops, - burst_size); - end_cycles = rte_rdtsc_precise(); - if (burst_received < burst_sent) - failed_polls++; - num_ops_received += burst_received; - - total_cycles += end_cycles - start_cycles; - } - - while (num_ops_received != num_to_submit) { - /* Sending 0 length burst to flush sw crypto device */ - rte_cryptodev_enqueue_burst(ts_params->dev_id, 0, - NULL, 0); - - start_cycles = rte_rdtsc_precise(); - burst_received = rte_cryptodev_dequeue_burst( - ts_params->dev_id, 0, proc_ops, - burst_size); - end_cycles = rte_rdtsc_precise(); - - total_cycles += end_cycles - start_cycles; - if (burst_received == 0) - failed_polls++; - num_ops_received += burst_received; - } - - printf("\n%u\t%u\t%u", num_sent, num_ops_received, burst_size); - printf("\t\t%"PRIu64, retries); - printf("\t%"PRIu64, failed_polls); - printf("\t\t%"PRIu64, total_cycles/num_ops_received); - printf("\t\t%"PRIu64, (total_cycles/num_ops_received) * - burst_size); - printf("\t\t%"PRIu64, - total_cycles / - (num_ops_received * pparams->buf_size)); - } - printf("\n"); - - for (i = 0; i < num_to_submit ; i++) { - rte_pktmbuf_free(c_ops[i]->sym->m_src); - rte_crypto_op_free(c_ops[i]); - } - - rte_cryptodev_sym_session_clear(ts_params->dev_id, sess); - rte_cryptodev_sym_session_free(sess); - - return TEST_SUCCESS; -} - -static int -test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams) -{ - uint32_t num_to_submit = pparams->total_operations; - struct rte_crypto_op *c_ops[num_to_submit]; - struct rte_crypto_op *proc_ops[num_to_submit]; - uint64_t failed_polls, retries, start_cycles, end_cycles, - total_cycles = 0; - uint32_t burst_sent = 0, burst_received = 0; - uint32_t i, burst_size, num_sent, num_ops_received; - uint32_t nb_ops; - - struct crypto_testsuite_params *ts_params = &testsuite_params; - - static struct rte_cryptodev_sym_session *sess; - - if (rte_cryptodev_count() == 0) { - printf("\nNo crypto devices found. Is PMD build configured?\n"); - return TEST_FAILED; - } - - /* Create Crypto session*/ - if (test_perf_create_armv8_session(ts_params->dev_id, - pparams->chain, pparams->cipher_algo, - pparams->key_length, pparams->auth_algo) == 0) - sess = test_crypto_session; - else - sess = NULL; - - /* Generate Crypto op data structure(s)*/ - for (i = 0; i < num_to_submit ; i++) { - struct rte_mbuf *m = test_perf_create_pktmbuf( - ts_params->mbuf_mp, - pparams->buf_size); - TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf"); - - struct rte_crypto_op *op = - rte_crypto_op_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC); - TEST_ASSERT_NOT_NULL(op, "Failed to allocate op"); - - op = test_perf_set_crypto_op_aes(op, m, sess, pparams->buf_size, - pparams->chain); - TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session"); - - c_ops[i] = op; - } - - printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, cipher key length:%u, " - "auth_algo:%s, Packet Size %u bytes", - pmd_name(gbl_driver_id), - ts_params->dev_id, 0, - chain_mode_name(pparams->chain), - rte_crypto_cipher_algorithm_strings[pparams->cipher_algo], - pparams->key_length, - rte_crypto_auth_algorithm_strings[pparams->auth_algo], - pparams->buf_size); - printf("\nOps Tx\tOps Rx\tOps/burst "); - printf("Retries " - "EmptyPolls\tIACycles/CyOp\tIACycles/Burst\tIACycles/Byte"); - - for (i = 2; i <= 128 ; i *= 2) { - num_sent = 0; - num_ops_received = 0; - retries = 0; - failed_polls = 0; - burst_size = i; - total_cycles = 0; - while (num_sent < num_to_submit) { - if ((num_to_submit - num_sent) < burst_size) - nb_ops = num_to_submit - num_sent; - else - nb_ops = burst_size; - - start_cycles = rte_rdtsc(); - burst_sent = rte_cryptodev_enqueue_burst( - ts_params->dev_id, - 0, &c_ops[num_sent], - nb_ops); - end_cycles = rte_rdtsc(); - - if (burst_sent == 0) - retries++; - num_sent += burst_sent; - total_cycles += (end_cycles - start_cycles); - - start_cycles = rte_rdtsc(); - burst_received = rte_cryptodev_dequeue_burst( - ts_params->dev_id, 0, proc_ops, - burst_size); - end_cycles = rte_rdtsc(); - if (burst_received < burst_sent) - failed_polls++; - num_ops_received += burst_received; - - total_cycles += end_cycles - start_cycles; - } - - while (num_ops_received != num_to_submit) { - /* Sending 0 length burst to flush sw crypto device */ - rte_cryptodev_enqueue_burst( - ts_params->dev_id, 0, NULL, 0); - - start_cycles = rte_rdtsc(); - burst_received = rte_cryptodev_dequeue_burst( - ts_params->dev_id, 0, proc_ops, burst_size); - end_cycles = rte_rdtsc(); - - total_cycles += end_cycles - start_cycles; - if (burst_received == 0) - failed_polls++; - num_ops_received += burst_received; - } - - printf("\n%u\t%u\t%u", num_sent, num_ops_received, burst_size); - printf("\t\t%"PRIu64, retries); - printf("\t%"PRIu64, failed_polls); - printf("\t\t%"PRIu64, total_cycles/num_ops_received); - printf("\t\t%"PRIu64, - (total_cycles/num_ops_received)*burst_size); - printf("\t\t%"PRIu64, - total_cycles/(num_ops_received*pparams->buf_size)); - } - printf("\n"); - - for (i = 0; i < num_to_submit ; i++) { - rte_pktmbuf_free(c_ops[i]->sym->m_src); - rte_crypto_op_free(c_ops[i]); - } - - return TEST_SUCCESS; -} - -static uint32_t get_auth_key_max_length(enum rte_crypto_auth_algorithm algo) -{ - switch (algo) { - case RTE_CRYPTO_AUTH_SNOW3G_UIA2: - return 16; - case RTE_CRYPTO_AUTH_SHA1_HMAC: - return 64; - case RTE_CRYPTO_AUTH_SHA224_HMAC: - return 64; - case RTE_CRYPTO_AUTH_SHA256_HMAC: - return 64; - case RTE_CRYPTO_AUTH_SHA384_HMAC: - return 128; - case RTE_CRYPTO_AUTH_SHA512_HMAC: - return 128; - default: - return 0; - } -} - -static uint32_t get_auth_digest_length(enum rte_crypto_auth_algorithm algo) -{ - switch (algo) { - case RTE_CRYPTO_AUTH_SNOW3G_UIA2: - return 4; - case RTE_CRYPTO_AUTH_SHA1_HMAC: - return TRUNCATED_DIGEST_BYTE_LENGTH_SHA1; - case RTE_CRYPTO_AUTH_SHA224_HMAC: - return TRUNCATED_DIGEST_BYTE_LENGTH_SHA224; - case RTE_CRYPTO_AUTH_SHA256_HMAC: - return TRUNCATED_DIGEST_BYTE_LENGTH_SHA256; - case RTE_CRYPTO_AUTH_SHA384_HMAC: - return TRUNCATED_DIGEST_BYTE_LENGTH_SHA384; - case RTE_CRYPTO_AUTH_SHA512_HMAC: - return TRUNCATED_DIGEST_BYTE_LENGTH_SHA512; - default: - return 0; - } -} - -static uint32_t get_aead_digest_length(enum rte_crypto_aead_algorithm algo) -{ - switch (algo) { - case RTE_CRYPTO_AEAD_AES_GCM: - return DIGEST_BYTE_LENGTH_AES_GCM; - default: - return 0; - } -} - -static uint8_t aes_key[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static uint8_t aes_iv[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static uint8_t aes_gcm_aad[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static uint8_t triple_des_key[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static uint8_t triple_des_iv[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static uint8_t hmac_sha_key[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static uint8_t snow3g_cipher_key[] = { - 0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC5, 0xB3, 0x00, - 0x95, 0x2C, 0x49, 0x10, 0x48, 0x81, 0xFF, 0x48 -}; - -static uint8_t snow3g_iv[] = { - 0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00, - 0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00 -}; - -static uint8_t snow3g_hash_key[] = { - 0xC7, 0x36, 0xC6, 0xAA, 0xB2, 0x2B, 0xFF, 0xF9, - 0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E -}; - -static int -test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain, - enum rte_crypto_cipher_algorithm cipher_algo, - unsigned cipher_key_len, - enum rte_crypto_auth_algorithm auth_algo) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct rte_crypto_sym_xform cipher_xform = { 0 }; - struct rte_crypto_sym_xform auth_xform = { 0 }; - - - /* Setup Cipher Parameters */ - cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - cipher_xform.cipher.algo = cipher_algo; - cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; - - cipher_xform.cipher.key.data = aes_key; - cipher_xform.cipher.key.length = cipher_key_len; - cipher_xform.cipher.iv.offset = IV_OFFSET; - cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH; - if (chain != CIPHER_ONLY) { - /* Setup HMAC Parameters */ - auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; - auth_xform.auth.algo = auth_algo; - auth_xform.auth.key.data = hmac_sha_key; - auth_xform.auth.key.length = get_auth_key_max_length(auth_algo); - auth_xform.auth.digest_length = - get_auth_digest_length(auth_algo); - } - - test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp); - switch (chain) { - case CIPHER_HASH: - cipher_xform.next = &auth_xform; - auth_xform.next = NULL; - /* Create Crypto session*/ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &cipher_xform, - ts_params->sess_mp); - case HASH_CIPHER: - auth_xform.next = &cipher_xform; - cipher_xform.next = NULL; - /* Create Crypto session*/ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &auth_xform, - ts_params->sess_mp); - case CIPHER_ONLY: - cipher_xform.next = NULL; - /* Create Crypto session*/ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &cipher_xform, - ts_params->sess_mp); - default: - return -1; - } -} - -#define SNOW3G_CIPHER_IV_LENGTH 16 - -static int -test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain, - enum rte_crypto_cipher_algorithm cipher_algo, unsigned cipher_key_len, - enum rte_crypto_auth_algorithm auth_algo) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct rte_crypto_sym_xform cipher_xform = {0}; - struct rte_crypto_sym_xform auth_xform = {0}; - - - /* Setup Cipher Parameters */ - cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - cipher_xform.cipher.algo = cipher_algo; - cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; - - cipher_xform.cipher.key.data = snow3g_cipher_key; - cipher_xform.cipher.key.length = cipher_key_len; - cipher_xform.cipher.iv.offset = IV_OFFSET; - cipher_xform.cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH; - - - /* Setup HMAC Parameters */ - auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; - auth_xform.auth.algo = auth_algo; - - auth_xform.auth.key.data = snow3g_hash_key; - auth_xform.auth.key.length = get_auth_key_max_length(auth_algo); - auth_xform.auth.digest_length = get_auth_digest_length(auth_algo); - /* Auth IV will be after cipher IV */ - auth_xform.auth.iv.offset = IV_OFFSET + SNOW3G_CIPHER_IV_LENGTH; - auth_xform.auth.iv.length = SNOW3G_CIPHER_IV_LENGTH; - - test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp); - switch (chain) { - case CIPHER_HASH: - cipher_xform.next = &auth_xform; - auth_xform.next = NULL; - /* Create Crypto session*/ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &cipher_xform, - ts_params->sess_mp); - case HASH_CIPHER: - auth_xform.next = &cipher_xform; - cipher_xform.next = NULL; - /* Create Crypto session*/ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &auth_xform, - ts_params->sess_mp); - case CIPHER_ONLY: - cipher_xform.next = NULL; - /* Create Crypto session*/ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &cipher_xform, - ts_params->sess_mp); - case HASH_ONLY: - auth_xform.next = NULL; - /* Create Crypto session */ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &auth_xform, - ts_params->sess_mp); - default: - return -1; - } -} - -static int -test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain, - enum rte_crypto_cipher_algorithm cipher_algo, - unsigned int key_len, - enum rte_crypto_auth_algorithm auth_algo, - enum rte_crypto_aead_algorithm aead_algo) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct rte_crypto_sym_xform cipher_xform = { 0 }; - struct rte_crypto_sym_xform auth_xform = { 0 }; - struct rte_crypto_sym_xform aead_xform = { 0 }; - - if (chain == CIPHER_HASH || chain == HASH_CIPHER) { - /* Setup Cipher Parameters */ - cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - cipher_xform.cipher.algo = cipher_algo; - cipher_xform.cipher.iv.offset = IV_OFFSET; - cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; - - switch (cipher_algo) { - case RTE_CRYPTO_CIPHER_3DES_CBC: - case RTE_CRYPTO_CIPHER_3DES_CTR: - cipher_xform.cipher.key.data = triple_des_key; - cipher_xform.cipher.iv.length = TRIPLE_DES_CIPHER_IV_LENGTH; - break; - case RTE_CRYPTO_CIPHER_AES_CBC: - case RTE_CRYPTO_CIPHER_AES_CTR: - cipher_xform.cipher.key.data = aes_key; - cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH; - break; - default: - return -1; - } - - cipher_xform.cipher.key.length = key_len; - - /* Setup Auth Parameters */ - auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; - auth_xform.auth.algo = auth_algo; - - switch (auth_algo) { - case RTE_CRYPTO_AUTH_SHA1_HMAC: - auth_xform.auth.key.data = hmac_sha_key; - break; - default: - return -1; - } - - auth_xform.auth.key.length = get_auth_key_max_length(auth_algo); - auth_xform.auth.digest_length = get_auth_digest_length(auth_algo); - } else if (chain == AEAD) { - /* Setup AEAD Parameters */ - aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD; - aead_xform.aead.op = RTE_CRYPTO_AEAD_OP_ENCRYPT; - aead_xform.aead.algo = aead_algo; - aead_xform.aead.iv.offset = IV_OFFSET; - - switch (aead_algo) { - case RTE_CRYPTO_AEAD_AES_GCM: - aead_xform.aead.key.data = aes_key; - aead_xform.aead.iv.length = AES_CIPHER_IV_LENGTH; - aead_xform.aead.aad_length = AES_GCM_AAD_LENGTH; - aead_xform.aead.digest_length = get_aead_digest_length(aead_algo); - break; - default: - return -1; - } - - aead_xform.aead.key.length = key_len; - } - - test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp); - switch (chain) { - case CIPHER_HASH: - cipher_xform.next = &auth_xform; - auth_xform.next = NULL; - /* Create Crypto session*/ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &cipher_xform, - ts_params->sess_mp); - case HASH_CIPHER: - auth_xform.next = &cipher_xform; - cipher_xform.next = NULL; - /* Create Crypto session*/ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &auth_xform, - ts_params->sess_mp); - case AEAD: - /* Create Crypto session*/ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &aead_xform, - ts_params->sess_mp); - default: - return -1; - } -} - -static int -test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain, - enum rte_crypto_cipher_algorithm cipher_algo, - unsigned int cipher_key_len, - enum rte_crypto_auth_algorithm auth_algo) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct rte_crypto_sym_xform cipher_xform = { 0 }; - struct rte_crypto_sym_xform auth_xform = { 0 }; - - /* Setup Cipher Parameters */ - cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - cipher_xform.cipher.algo = cipher_algo; - - switch (cipher_algo) { - case RTE_CRYPTO_CIPHER_AES_CBC: - cipher_xform.cipher.key.data = aes_cbc_128_key; - break; - default: - return -1; - } - - cipher_xform.cipher.key.length = cipher_key_len; - cipher_xform.cipher.iv.offset = IV_OFFSET; - cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH; - - /* Setup Auth Parameters */ - auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; - auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; - auth_xform.auth.algo = auth_algo; - - auth_xform.auth.digest_length = get_auth_digest_length(auth_algo); - - test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp); - - switch (chain) { - case CIPHER_HASH: - cipher_xform.next = &auth_xform; - auth_xform.next = NULL; - /* Encrypt and hash the result */ - cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; - /* Create Crypto session*/ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &cipher_xform, - ts_params->sess_mp); - case HASH_CIPHER: - auth_xform.next = &cipher_xform; - cipher_xform.next = NULL; - /* Hash encrypted message and decrypt */ - cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT; - /* Create Crypto session*/ - return rte_cryptodev_sym_session_init(dev_id, - test_crypto_session, &auth_xform, - ts_params->sess_mp); - default: - return -1; - } -} - -static struct rte_mbuf * -test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz) -{ - struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); - - if (rte_pktmbuf_append(m, buf_sz) == NULL) { - rte_pktmbuf_free(m); - return NULL; - } - - memset(rte_pktmbuf_mtod(m, uint8_t *), 0, buf_sz); - - return m; -} - -static inline struct rte_crypto_op * -test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m, - struct rte_cryptodev_sym_session *sess, unsigned int data_len, - enum chain_mode chain) -{ - if (rte_crypto_op_attach_sym_session(op, sess) != 0) { - rte_crypto_op_free(op); - return NULL; - } - - /* Authentication Parameters */ - if (chain == CIPHER_ONLY) { - op->sym->auth.digest.data = NULL; - op->sym->auth.digest.phys_addr = 0; - op->sym->auth.data.offset = 0; - op->sym->auth.data.length = 0; - } else { - op->sym->auth.digest.data = rte_pktmbuf_mtod_offset(m, - uint8_t *, data_len); - op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m, - data_len); - op->sym->auth.data.offset = 0; - op->sym->auth.data.length = data_len; - } - - - /* Copy the IV at the end of the crypto operation */ - rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET), - aes_iv, AES_CIPHER_IV_LENGTH); - - /* Cipher Parameters */ - op->sym->cipher.data.offset = 0; - op->sym->cipher.data.length = data_len; - - op->sym->m_src = m; - - return op; -} - -static inline struct rte_crypto_op * -test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m, - struct rte_cryptodev_sym_session *sess, unsigned int data_len, - enum chain_mode chain __rte_unused) -{ - if (rte_crypto_op_attach_sym_session(op, sess) != 0) { - rte_crypto_op_free(op); - return NULL; - } - - /* Authentication Parameters */ - op->sym->aead.digest.data = (uint8_t *)m->buf_addr + - (m->data_off + data_len); - op->sym->aead.digest.phys_addr = - rte_pktmbuf_mtophys_offset(m, data_len); - op->sym->aead.aad.data = aes_gcm_aad; - - /* Copy IV at the end of the crypto operation */ - rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET), - aes_iv, AES_CIPHER_IV_LENGTH); - - /* Data lengths/offsets Parameters */ - op->sym->aead.data.offset = 0; - op->sym->aead.data.length = data_len; - - op->sym->m_src = m; - - return op; -} - -static inline struct rte_crypto_op * -test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m, - struct rte_cryptodev_sym_session *sess, unsigned int data_len) -{ - uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, - uint8_t *, IV_OFFSET); - - if (rte_crypto_op_attach_sym_session(op, sess) != 0) { - rte_crypto_op_free(op); - return NULL; - } - - rte_memcpy(iv_ptr, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH); - - /* Authentication Parameters */ - op->sym->auth.digest.data = (uint8_t *)m->buf_addr + - (m->data_off + data_len); - op->sym->auth.digest.phys_addr = - rte_pktmbuf_mtophys_offset(m, data_len); - - /* Data lengths/offsets Parameters */ - op->sym->auth.data.offset = 0; - op->sym->auth.data.length = data_len << 3; - - op->sym->cipher.data.offset = 0; - op->sym->cipher.data.length = data_len << 3; - - op->sym->m_src = m; - - return op; -} - -static inline struct rte_crypto_op * -test_perf_set_crypto_op_snow3g_cipher(struct rte_crypto_op *op, - struct rte_mbuf *m, - struct rte_cryptodev_sym_session *sess, - unsigned data_len) -{ - if (rte_crypto_op_attach_sym_session(op, sess) != 0) { - rte_crypto_op_free(op); - return NULL; - } - - /* Copy IV at the end of the crypto operation */ - rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET), - snow3g_iv, SNOW3G_CIPHER_IV_LENGTH); - - /* Cipher Parameters */ - op->sym->cipher.data.offset = 0; - op->sym->cipher.data.length = data_len << 3; - - rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET), - snow3g_iv, - SNOW3G_CIPHER_IV_LENGTH); - - op->sym->m_src = m; - - return op; -} - - -static inline struct rte_crypto_op * -test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op, - struct rte_mbuf *m, - struct rte_cryptodev_sym_session *sess, - unsigned int data_len) -{ - uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, - uint8_t *, IV_OFFSET); - - if (rte_crypto_op_attach_sym_session(op, sess) != 0) { - rte_crypto_op_free(op); - return NULL; - } - - rte_memcpy(iv_ptr, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH); - - /* Authentication Parameters */ - - op->sym->auth.digest.data = - (uint8_t *)rte_pktmbuf_mtod_offset(m, uint8_t *, - data_len); - op->sym->auth.digest.phys_addr = - rte_pktmbuf_mtophys_offset(m, data_len + - SNOW3G_CIPHER_IV_LENGTH); - - /* Data lengths/offsets Parameters */ - op->sym->auth.data.offset = 0; - op->sym->auth.data.length = data_len << 3; - - op->sym->m_src = m; - - return op; -} - - -static inline struct rte_crypto_op * -test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m, - struct rte_cryptodev_sym_session *sess, unsigned int data_len, - enum chain_mode chain __rte_unused) -{ - if (rte_crypto_op_attach_sym_session(op, sess) != 0) { - rte_crypto_op_free(op); - return NULL; - } - - /* Authentication Parameters */ - op->sym->auth.digest.data = (uint8_t *)m->buf_addr + - (m->data_off + data_len); - op->sym->auth.digest.phys_addr = - rte_pktmbuf_mtophys_offset(m, data_len); - - /* Copy IV at the end of the crypto operation */ - rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET), - triple_des_iv, TRIPLE_DES_CIPHER_IV_LENGTH); - - /* Data lengths/offsets Parameters */ - op->sym->auth.data.offset = 0; - op->sym->auth.data.length = data_len; - - op->sym->cipher.data.offset = 0; - op->sym->cipher.data.length = data_len; - - op->sym->m_src = m; - - return op; -} - -/* An mbuf set is used in each burst. An mbuf can be used by multiple bursts at - * same time, i.e. as they're not dereferenced there's no need to wait until - * finished with to re-use */ -#define NUM_MBUF_SETS 8 - -static int -test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id, - struct perf_test_params *pparams) -{ - uint16_t i, k, l, m; - uint16_t j = 0; - uint16_t ops_unused = 0; - - uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0; - uint64_t processed = 0, failed_polls = 0, retries = 0; - uint64_t tsc_start = 0, tsc_end = 0; - - uint16_t digest_length = get_auth_digest_length(pparams->auth_algo); - - struct rte_crypto_op *ops[pparams->burst_size]; - struct rte_crypto_op *proc_ops[pparams->burst_size]; - - struct rte_mbuf *mbufs[pparams->burst_size * 8]; - - struct crypto_testsuite_params *ts_params = &testsuite_params; - - static struct rte_cryptodev_sym_session *sess; - - if (rte_cryptodev_count() == 0) { - printf("\nNo crypto devices available. Is kernel driver loaded?\n"); - return TEST_FAILED; - } - - /* Create Crypto session*/ - if (test_perf_create_aes_sha_session(ts_params->dev_id, - pparams->chain, pparams->cipher_algo, - pparams->key_length, pparams->auth_algo) == 0) - sess = test_crypto_session; - else - sess = NULL; - TEST_ASSERT_NOT_NULL(sess, "Session creation failed"); - - /* Generate a burst of crypto operations */ - for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) { - mbufs[i] = test_perf_create_pktmbuf( - ts_params->mbuf_mp, - pparams->buf_size); - - if (mbufs[i] == NULL) { - printf("\nFailed to get mbuf - freeing the rest.\n"); - for (k = 0; k < i; k++) - rte_pktmbuf_free(mbufs[k]); - return -1; - } - - /* Make room for Digest in mbuf */ - if (pparams->chain != CIPHER_ONLY) - rte_pktmbuf_append(mbufs[i], digest_length); - } - - - tsc_start = rte_rdtsc_precise(); - - while (total_enqueued < pparams->total_operations) { - uint16_t burst_size = - total_enqueued+pparams->burst_size <= pparams->total_operations ? - pparams->burst_size : pparams->total_operations-total_enqueued; - uint16_t ops_needed = burst_size-ops_unused; - - if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){ - printf("\nFailed to alloc enough ops, finish dequeuing " - "and free ops below."); - } else { - for (i = 0; i < ops_needed; i++) - ops[i] = test_perf_set_crypto_op_aes(ops[i], - mbufs[i + (pparams->burst_size * - (j % NUM_MBUF_SETS))], - sess, pparams->buf_size, - pparams->chain); - - /* enqueue burst */ - burst_enqueued = rte_cryptodev_enqueue_burst(dev_id, - queue_id, ops, burst_size); - - if (burst_enqueued < burst_size) - retries++; - - ops_unused = burst_size-burst_enqueued; - total_enqueued += burst_enqueued; - } - - /* dequeue burst */ - burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id, - proc_ops, pparams->burst_size); - if (burst_dequeued == 0) - failed_polls++; - else { - processed += burst_dequeued; - - for (l = 0; l < burst_dequeued; l++) - rte_crypto_op_free(proc_ops[l]); - } - j++; - } - - /* Dequeue any operations still in the crypto device */ - while (processed < pparams->total_operations) { - /* Sending 0 length burst to flush sw crypto device */ - rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0); - - /* dequeue burst */ - burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id, - proc_ops, pparams->burst_size); - if (burst_dequeued == 0) - failed_polls++; - else { - processed += burst_dequeued; - - for (m = 0; m < burst_dequeued; m++) - rte_crypto_op_free(proc_ops[m]); - } - } - - tsc_end = rte_rdtsc_precise(); - - double ops_s = ((double)processed / (tsc_end - tsc_start)) * rte_get_tsc_hz(); - double throughput = (ops_s * pparams->buf_size * 8) / 1000000000; - - printf("\t%u\t%6.2f\t%10.2f\t%8"PRIu64"\t%8"PRIu64, pparams->buf_size, ops_s/1000000, - throughput, retries, failed_polls); - - for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++) - rte_pktmbuf_free(mbufs[i]); - - rte_cryptodev_sym_session_clear(ts_params->dev_id, sess); - rte_cryptodev_sym_session_free(sess); - - printf("\n"); - return TEST_SUCCESS; -} - - -static int -test_perf_snow3g(uint8_t dev_id, uint16_t queue_id, - struct perf_test_params *pparams) -{ - uint16_t i, k, l, m; - uint16_t j = 0; - uint16_t ops_unused = 0; - uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0; - uint64_t processed = 0, failed_polls = 0, retries = 0; - uint64_t tsc_start = 0, tsc_end = 0; - - uint16_t digest_length = get_auth_digest_length(pparams->auth_algo); - - struct rte_crypto_op *ops[pparams->burst_size]; - struct rte_crypto_op *proc_ops[pparams->burst_size]; - - struct rte_mbuf *mbufs[pparams->burst_size * NUM_MBUF_SETS]; - - struct crypto_testsuite_params *ts_params = &testsuite_params; - - static struct rte_cryptodev_sym_session *sess; - - if (rte_cryptodev_count() == 0) { - printf("\nNo crypto devices found. Is PMD build configured?\n"); - printf("\nAnd is kernel driver loaded for HW PMDs?\n"); - return TEST_FAILED; - } - - /* Create Crypto session*/ - if (test_perf_create_snow3g_session(ts_params->dev_id, - pparams->chain, pparams->cipher_algo, - pparams->key_length, pparams->auth_algo) == 0) - sess = test_crypto_session; - else - sess = NULL; - TEST_ASSERT_NOT_NULL(sess, "Session creation failed"); - - /* Generate a burst of crypto operations */ - for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) { - /* - * Buffer size is allocated, for perf tests they - * are equal + digest len. - */ - mbufs[i] = test_perf_create_pktmbuf( - ts_params->mbuf_mp, - pparams->buf_size + - digest_length); - - if (mbufs[i] == NULL) { - printf("\nFailed to get mbuf - freeing the rest.\n"); - for (k = 0; k < i; k++) - rte_pktmbuf_free(mbufs[k]); - return -1; - } - - } - - tsc_start = rte_rdtsc_precise(); - - while (total_enqueued < pparams->total_operations) { - uint16_t burst_size = - (total_enqueued+pparams->burst_size) - <= pparams->total_operations ? - pparams->burst_size : pparams->total_operations-total_enqueued; - uint16_t ops_needed = burst_size-ops_unused; - /* Handle the last burst correctly */ - uint16_t op_offset = pparams->burst_size - burst_size; - - if (ops_needed != - rte_crypto_op_bulk_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC, - ops+op_offset, ops_needed)) { - printf("\nFailed to alloc enough ops."); - /*Don't exit, dequeue, more ops should become available*/ - } else { - for (i = 0; i < ops_needed; i++) { - if (pparams->chain == HASH_ONLY) - ops[i+op_offset] = - test_perf_set_crypto_op_snow3g_hash(ops[i+op_offset], - mbufs[i + - (pparams->burst_size * (j % NUM_MBUF_SETS))], - sess, - pparams->buf_size); - else if (pparams->chain == CIPHER_ONLY) - ops[i+op_offset] = - test_perf_set_crypto_op_snow3g_cipher(ops[i+op_offset], - mbufs[i + - (pparams->burst_size * (j % NUM_MBUF_SETS))], - sess, - pparams->buf_size); - else - return 1; - } - - /* enqueue burst */ - burst_enqueued = - rte_cryptodev_enqueue_burst(dev_id, queue_id, - ops+op_offset, burst_size); - - if (burst_enqueued < burst_size) - retries++; - - ops_unused = burst_size-burst_enqueued; - total_enqueued += burst_enqueued; - } - - /* dequeue burst */ - burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id, - proc_ops, pparams->burst_size); - if (burst_dequeued == 0) { - failed_polls++; - } else { - processed += burst_dequeued; - for (l = 0; l < burst_dequeued; l++) - rte_crypto_op_free(proc_ops[l]); - } - j++; - } - - /* Dequeue any operations still in the crypto device */ - while (processed < pparams->total_operations) { - /* Sending 0 length burst to flush sw crypto device */ - rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0); - - /* dequeue burst */ - burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id, - proc_ops, pparams->burst_size); - if (burst_dequeued == 0) - failed_polls++; - else { - processed += burst_dequeued; - for (m = 0; m < burst_dequeued; m++) - rte_crypto_op_free(proc_ops[m]); - } - } - - tsc_end = rte_rdtsc_precise(); - - double ops_s = ((double)processed / (tsc_end - tsc_start)) * rte_get_tsc_hz(); - double cycles_burst = (double) (tsc_end - tsc_start) / - (double) processed * pparams->burst_size; - double cycles_buff = (double) (tsc_end - tsc_start) / (double) processed; - double cycles_B = cycles_buff / pparams->buf_size; - double throughput = (ops_s * pparams->buf_size * 8) / 1000000; - - if (gbl_driver_id == rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD))) { - /* Cycle count misleading on HW devices for this test, so don't print */ - printf("%4u\t%6.2f\t%10.2f\t n/a \t\t n/a " - "\t\t n/a \t\t%8"PRIu64"\t%8"PRIu64, - pparams->buf_size, ops_s/1000000, - throughput, retries, failed_polls); - } else { - printf("%4u\t%6.2f\t%10.2f\t%10.2f\t%8.2f" - "\t%8.2f\t%8"PRIu64"\t%8"PRIu64, - pparams->buf_size, ops_s/1000000, throughput, cycles_burst, - cycles_buff, cycles_B, retries, failed_polls); - } - - for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++) - rte_pktmbuf_free(mbufs[i]); - - rte_cryptodev_sym_session_clear(ts_params->dev_id, sess); - rte_cryptodev_sym_session_free(sess); - - printf("\n"); - return TEST_SUCCESS; -} - -static int -test_perf_openssl(uint8_t dev_id, uint16_t queue_id, - struct perf_test_params *pparams) -{ - uint16_t i, k, l, m; - uint16_t j = 0; - uint16_t ops_unused = 0; - - uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0; - uint64_t processed = 0, failed_polls = 0, retries = 0; - uint64_t tsc_start = 0, tsc_end = 0; - - struct rte_crypto_op *ops[pparams->burst_size]; - struct rte_crypto_op *proc_ops[pparams->burst_size]; - - struct rte_mbuf *mbufs[pparams->burst_size * NUM_MBUF_SETS]; - - struct crypto_testsuite_params *ts_params = &testsuite_params; - - static struct rte_cryptodev_sym_session *sess; - - static struct rte_crypto_op *(*test_perf_set_crypto_op) - (struct rte_crypto_op *, struct rte_mbuf *, - struct rte_cryptodev_sym_session *, - unsigned int, - enum chain_mode); - - if (pparams->chain == AEAD) - test_perf_set_crypto_op = - test_perf_set_crypto_op_aes_gcm; - else { - switch (pparams->cipher_algo) { - case RTE_CRYPTO_CIPHER_3DES_CBC: - case RTE_CRYPTO_CIPHER_3DES_CTR: - test_perf_set_crypto_op = test_perf_set_crypto_op_3des; - break; - case RTE_CRYPTO_CIPHER_AES_CBC: - case RTE_CRYPTO_CIPHER_AES_CTR: - test_perf_set_crypto_op = test_perf_set_crypto_op_aes; - break; - default: - return TEST_FAILED; - } - } - - if (rte_cryptodev_count() == 0) { - printf("\nNo crypto devices found. Is PMD build configured?\n"); - return TEST_FAILED; - } - - /* Create Crypto session*/ - if (test_perf_create_openssl_session(ts_params->dev_id, - pparams->chain, pparams->cipher_algo, - pparams->key_length, pparams->auth_algo, - pparams->aead_algo) == 0) - sess = test_crypto_session; - else - sess = NULL; - TEST_ASSERT_NOT_NULL(sess, "Session creation failed"); - - /* Generate a burst of crypto operations */ - for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) { - mbufs[i] = test_perf_create_pktmbuf( - ts_params->mbuf_mp, - pparams->buf_size); - - if (mbufs[i] == NULL) { - printf("\nFailed to get mbuf - freeing the rest.\n"); - for (k = 0; k < i; k++) - rte_pktmbuf_free(mbufs[k]); - return -1; - } - } - - tsc_start = rte_rdtsc_precise(); - - while (total_enqueued < pparams->total_operations) { - uint16_t burst_size = - total_enqueued + pparams->burst_size <= - pparams->total_operations ? pparams->burst_size : - pparams->total_operations - total_enqueued; - uint16_t ops_needed = burst_size - ops_unused; - - if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){ - printf("\nFailed to alloc enough ops, finish dequeuing " - "and free ops below."); - } else { - for (i = 0; i < ops_needed; i++) - ops[i] = test_perf_set_crypto_op(ops[i], - mbufs[i + (pparams->burst_size * - (j % NUM_MBUF_SETS))], - sess, pparams->buf_size, - pparams->chain); - - /* enqueue burst */ - burst_enqueued = rte_cryptodev_enqueue_burst(dev_id, - queue_id, ops, burst_size); - - if (burst_enqueued < burst_size) - retries++; - - ops_unused = burst_size - burst_enqueued; - total_enqueued += burst_enqueued; - } - - /* dequeue burst */ - burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id, - proc_ops, pparams->burst_size); - if (burst_dequeued == 0) - failed_polls++; - else { - processed += burst_dequeued; - - for (l = 0; l < burst_dequeued; l++) - rte_crypto_op_free(proc_ops[l]); - } - j++; - } - - /* Dequeue any operations still in the crypto device */ - while (processed < pparams->total_operations) { - /* Sending 0 length burst to flush sw crypto device */ - rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0); - - /* dequeue burst */ - burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id, - proc_ops, pparams->burst_size); - if (burst_dequeued == 0) - failed_polls++; - else { - processed += burst_dequeued; - - for (m = 0; m < burst_dequeued; m++) - rte_crypto_op_free(proc_ops[m]); - } - } - - tsc_end = rte_rdtsc_precise(); - - double ops_s = ((double)processed / (tsc_end - tsc_start)) - * rte_get_tsc_hz(); - double throughput = (ops_s * pparams->buf_size * NUM_MBUF_SETS) - / 1000000000; - - printf("\t%u\t%6.2f\t%10.2f\t%8"PRIu64"\t%8"PRIu64, pparams->buf_size, - ops_s / 1000000, throughput, retries, failed_polls); - - for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++) - rte_pktmbuf_free(mbufs[i]); - - rte_cryptodev_sym_session_clear(ts_params->dev_id, sess); - rte_cryptodev_sym_session_free(sess); - - printf("\n"); - return TEST_SUCCESS; -} - -static int -test_perf_armv8(uint8_t dev_id, uint16_t queue_id, - struct perf_test_params *pparams) -{ - uint16_t i, k, l, m; - uint16_t j = 0; - uint16_t ops_unused = 0; - uint16_t burst_size; - uint16_t ops_needed; - - uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0; - uint64_t processed = 0, failed_polls = 0, retries = 0; - uint64_t tsc_start = 0, tsc_end = 0; - - struct rte_crypto_op *ops[pparams->burst_size]; - struct rte_crypto_op *proc_ops[pparams->burst_size]; - - struct rte_mbuf *mbufs[pparams->burst_size * NUM_MBUF_SETS]; - - struct crypto_testsuite_params *ts_params = &testsuite_params; - - static struct rte_cryptodev_sym_session *sess; - - if (rte_cryptodev_count() == 0) { - printf("\nNo crypto devices found. Is PMD build configured?\n"); - return TEST_FAILED; - } - - /* Create Crypto session*/ - if (test_perf_create_armv8_session(ts_params->dev_id, - pparams->chain, pparams->cipher_algo, - pparams->key_length, pparams->auth_algo) == 0) - sess = test_crypto_session; - else - sess = NULL; - TEST_ASSERT_NOT_NULL(sess, "Session creation failed"); - - /* Generate a burst of crypto operations */ - for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) { - mbufs[i] = test_perf_create_pktmbuf( - ts_params->mbuf_mp, - pparams->buf_size); - - if (mbufs[i] == NULL) { - printf("\nFailed to get mbuf - freeing the rest.\n"); - for (k = 0; k < i; k++) - rte_pktmbuf_free(mbufs[k]); - return -1; - } - } - - tsc_start = rte_rdtsc(); - - while (total_enqueued < pparams->total_operations) { - if ((total_enqueued + pparams->burst_size) <= - pparams->total_operations) - burst_size = pparams->burst_size; - else - burst_size = pparams->total_operations - total_enqueued; - - ops_needed = burst_size - ops_unused; - - if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){ - printf("\nFailed to alloc enough ops, finish dequeuing " - "and free ops below."); - } else { - for (i = 0; i < ops_needed; i++) - ops[i] = test_perf_set_crypto_op_aes(ops[i], - mbufs[i + (pparams->burst_size * - (j % NUM_MBUF_SETS))], sess, - pparams->buf_size, - pparams->chain); - - /* enqueue burst */ - burst_enqueued = rte_cryptodev_enqueue_burst(dev_id, - queue_id, ops, burst_size); - - if (burst_enqueued < burst_size) - retries++; - - ops_unused = burst_size - burst_enqueued; - total_enqueued += burst_enqueued; - } - - /* dequeue burst */ - burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id, - proc_ops, pparams->burst_size); - if (burst_dequeued == 0) - failed_polls++; - else { - processed += burst_dequeued; - - for (l = 0; l < burst_dequeued; l++) - rte_crypto_op_free(proc_ops[l]); - } - j++; - } - - /* Dequeue any operations still in the crypto device */ - while (processed < pparams->total_operations) { - /* Sending 0 length burst to flush sw crypto device */ - rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0); - - /* dequeue burst */ - burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id, - proc_ops, pparams->burst_size); - if (burst_dequeued == 0) - failed_polls++; - else { - processed += burst_dequeued; - - for (m = 0; m < burst_dequeued; m++) - rte_crypto_op_free(proc_ops[m]); - } - } - - tsc_end = rte_rdtsc(); - - double ops_s = ((double)processed / (tsc_end - tsc_start)) - * rte_get_tsc_hz(); - double throughput = (ops_s * pparams->buf_size * NUM_MBUF_SETS) - / 1000000000; - - printf("\t%u\t%6.2f\t%10.2f\t%8"PRIu64"\t%8"PRIu64, pparams->buf_size, - ops_s / 1000000, throughput, retries, failed_polls); - - for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++) - rte_pktmbuf_free(mbufs[i]); - - printf("\n"); - return TEST_SUCCESS; -} - -/* - - perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA1); - perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA_256); - perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA_512); - - perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA1); - perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA_256); - perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA_512); - - perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA1); - perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA_256); - perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA_512); - */ -static int -test_perf_aes_cbc_encrypt_digest_vary_pkt_size(void) -{ - unsigned total_operations = 1000000; - unsigned burst_size = 32; - unsigned buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048 }; - uint8_t i, j; - - struct perf_test_params params_set[] = { - { - .chain = CIPHER_ONLY, - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_NULL - }, - { - .chain = CIPHER_HASH, - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 32, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 32, - .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 32, - .auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC - }, - }; - - for (i = 0; i < RTE_DIM(params_set); i++) { - - params_set[i].total_operations = total_operations; - params_set[i].burst_size = burst_size; - printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u." - " burst_size: %d ops\n", - chain_mode_name(params_set[i].chain), - rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo], - rte_crypto_auth_algorithm_strings[params_set[i].auth_algo], - params_set[i].key_length, - burst_size); - printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t" - "Retries\tEmptyPolls\n"); - for (j = 0; j < RTE_DIM(buf_lengths); j++) { - params_set[i].buf_size = buf_lengths[j]; - test_perf_aes_sha(testsuite_params.dev_id, 0, - ¶ms_set[i]); - } - } - return 0; -} - -static int -test_perf_snow3G_vary_pkt_size(void) -{ - unsigned total_operations = 1000000; - uint8_t i, j; - unsigned k; - uint16_t burst_sizes[] = { 64 }; - uint16_t buf_lengths[] = { 40, 64, 80, 120, 240, 256, 400, 512, 600, 1024, 2048 }; - - struct perf_test_params params_set[] = { - { - .chain = CIPHER_ONLY, - .cipher_algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_NULL, - }, - { - .chain = HASH_ONLY, - .cipher_algo = RTE_CRYPTO_CIPHER_NULL, - .auth_algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2, - .key_length = 16 - }, - }; - - printf("\n\nStart %s.", __func__); - printf("\nTest to measure max throughput at various pkt sizes."); - printf("\nOn HW devices t'put maximised when high Retries and EmptyPolls" - " so cycle cost not relevant (n/a displayed)."); - - for (i = 0; i < RTE_DIM(params_set); i++) { - printf("\n\n"); - params_set[i].total_operations = total_operations; - for (k = 0; k < RTE_DIM(burst_sizes); k++) { - enum rte_crypto_cipher_algorithm cipher_algo = - params_set[i].cipher_algo; - enum rte_crypto_auth_algorithm auth_algo = - params_set[i].auth_algo; - printf("\nOn %s dev%u qp%u, %s, " - "cipher algo:%s, auth algo:%s, burst_size: %d ops", - pmd_name(gbl_driver_id), - testsuite_params.dev_id, 0, - chain_mode_name(params_set[i].chain), - rte_crypto_cipher_algorithm_strings[cipher_algo], - rte_crypto_auth_algorithm_strings[auth_algo], - burst_sizes[k]); - - params_set[i].burst_size = burst_sizes[k]; - printf("\nPktSzB\tOp/s(M)\tThruput(Mbps)\tCycles/Burst\t" - "Cycles/buf\tCycles/B\tRetries\t\tEmptyPolls\n"); - for (j = 0; j < RTE_DIM(buf_lengths); j++) { - - params_set[i].buf_size = buf_lengths[j]; - - test_perf_snow3g(testsuite_params.dev_id, 0, ¶ms_set[i]); - } - } - } - - return 0; -} - -static int -test_perf_openssl_vary_pkt_size(void) -{ - unsigned int total_operations = 10000; - unsigned int burst_size = { 64 }; - unsigned int buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536, - 1792, 2048 }; - uint8_t i, j; - - struct perf_test_params params_set[] = { - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC, - .key_length = 24, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR, - .key_length = 32, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR, - .key_length = 24, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = AEAD, - - .aead_algo = RTE_CRYPTO_AEAD_AES_GCM, - .key_length = 16, - }, - }; - - for (i = 0; i < RTE_DIM(params_set); i++) { - params_set[i].total_operations = total_operations; - params_set[i].burst_size = burst_size; - if (params_set[i].chain == AEAD) { - enum rte_crypto_aead_algorithm aead_algo = - params_set[i].aead_algo; - printf("\n%s. aead algo: %s key size=%u." - " burst_size: %d ops\n", - chain_mode_name(params_set[i].chain), - rte_crypto_aead_algorithm_strings[aead_algo], - params_set[i].key_length, - burst_size); - } else { - enum rte_crypto_cipher_algorithm cipher_algo = - params_set[i].cipher_algo; - enum rte_crypto_auth_algorithm auth_algo = - params_set[i].auth_algo; - printf("\n%s. cipher algo: %s auth algo: %s key size=%u." - " burst_size: %d ops\n", - chain_mode_name(params_set[i].chain), - rte_crypto_cipher_algorithm_strings[cipher_algo], - rte_crypto_auth_algorithm_strings[auth_algo], - params_set[i].key_length, - burst_size); - } - printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\tRetries\t" - "EmptyPolls\n"); - for (j = 0; j < RTE_DIM(buf_lengths); j++) { - params_set[i].buf_size = buf_lengths[j]; - test_perf_openssl(testsuite_params.dev_id, 0, - ¶ms_set[i]); - } - } - - return 0; -} - -static int -test_perf_openssl_vary_burst_size(void) -{ - unsigned int total_operations = 4096; - uint16_t buf_lengths[] = { 40 }; - uint8_t i, j; - - struct perf_test_params params_set[] = { - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CBC, - .key_length = 24, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR, - .key_length = 32, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_3DES_CTR, - .key_length = 24, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = AEAD, - - .aead_algo = RTE_CRYPTO_AEAD_AES_GCM, - .key_length = 16, - }, - }; - - printf("\n\nStart %s.", __func__); - printf("\nThis Test measures the average IA cycle cost using a " - "constant request(packet) size. "); - printf("Cycle cost is only valid when indicators show device is not" - " busy, i.e. Retries and EmptyPolls = 0"); - - for (i = 0; i < RTE_DIM(params_set); i++) { - printf("\n"); - params_set[i].total_operations = total_operations; - - for (j = 0; j < RTE_DIM(buf_lengths); j++) { - params_set[i].buf_size = buf_lengths[j]; - test_perf_openssl_optimise_cyclecount(¶ms_set[i]); - } - } - - return 0; -} - -static int -test_perf_armv8_vary_pkt_size(void) -{ - unsigned int total_operations = 100000; - unsigned int burst_size = { 64 }; - unsigned int buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536, - 1792, 2048 }; - uint8_t i, j; - - struct perf_test_params params_set[] = { - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = HASH_CIPHER, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC - }, - { - .chain = HASH_CIPHER, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC - }, - }; - - for (i = 0; i < RTE_DIM(params_set); i++) { - params_set[i].total_operations = total_operations; - params_set[i].burst_size = burst_size; - printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u." - " burst_size: %d ops\n", - chain_mode_name(params_set[i].chain), - rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo], - rte_crypto_auth_algorithm_strings[params_set[i].auth_algo], - params_set[i].key_length, - burst_size); - printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\tRetries\t" - "EmptyPolls\n"); - for (j = 0; j < RTE_DIM(buf_lengths); j++) { - params_set[i].buf_size = buf_lengths[j]; - test_perf_armv8(testsuite_params.dev_id, 0, - ¶ms_set[i]); - } - } - - return 0; -} - -static int -test_perf_armv8_vary_burst_size(void) -{ - unsigned int total_operations = 4096; - uint16_t buf_lengths[] = { 64 }; - uint8_t i, j; - - struct perf_test_params params_set[] = { - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = HASH_CIPHER, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }, - { - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC - }, - { - .chain = HASH_CIPHER, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC - }, - }; - - printf("\n\nStart %s.", __func__); - printf("\nThis Test measures the average IA cycle cost using a " - "constant request(packet) size. "); - printf("Cycle cost is only valid when indicators show device is " - "not busy, i.e. Retries and EmptyPolls = 0"); - - for (i = 0; i < RTE_DIM(params_set); i++) { - printf("\n"); - params_set[i].total_operations = total_operations; - - for (j = 0; j < RTE_DIM(buf_lengths); j++) { - params_set[i].buf_size = buf_lengths[j]; - test_perf_armv8_optimise_cyclecount(¶ms_set[i]); - } - } - - return 0; -} - -static int -test_perf_aes_cbc_vary_burst_size(void) -{ - return test_perf_crypto_qp_vary_burst_size(testsuite_params.dev_id); -} - - -static struct rte_cryptodev_sym_session * -test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams) -{ - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct rte_crypto_sym_xform aead_xform = { 0 }; - - uint8_t aead_key[pparams->session_attrs->key_aead_len]; - - memcpy(aead_key, pparams->session_attrs->key_aead_data, - pparams->session_attrs->key_aead_len); - - aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD; - aead_xform.next = NULL; - - aead_xform.aead.algo = pparams->session_attrs->aead_algorithm; - aead_xform.aead.op = pparams->session_attrs->aead; - aead_xform.aead.key.data = aead_key; - aead_xform.aead.key.length = pparams->session_attrs->key_aead_len; - aead_xform.aead.iv.length = pparams->session_attrs->iv_len; - aead_xform.aead.iv.offset = IV_OFFSET; - aead_xform.aead.aad_length = pparams->session_attrs->aad_len; - aead_xform.aead.digest_length = pparams->session_attrs->digest_len; - - test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp); - - rte_cryptodev_sym_session_init(dev_id, test_crypto_session, - &aead_xform, ts_params->sess_mp); - - return test_crypto_session; -} - -static inline struct rte_crypto_op * -perf_gcm_set_crypto_op(struct rte_crypto_op *op, struct rte_mbuf *m, - struct rte_cryptodev_sym_session *sess, - struct crypto_params *m_hlp, - struct perf_test_params *params) -{ - uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, - uint8_t *, IV_OFFSET); - - if (rte_crypto_op_attach_sym_session(op, sess) != 0) { - rte_crypto_op_free(op); - return NULL; - } - - op->sym->aead.digest.data = m_hlp->digest; - op->sym->aead.digest.phys_addr = rte_pktmbuf_mtophys_offset( - m, - params->session_attrs->aad_len + - params->symmetric_op->p_len); - - - op->sym->aead.aad.data = m_hlp->aad; - op->sym->aead.aad.phys_addr = rte_pktmbuf_mtophys(m); - - rte_memcpy(op->sym->aead.aad.data, params->symmetric_op->aad_data, - params->session_attrs->aad_len); - - rte_memcpy(iv_ptr, params->session_attrs->iv_data, - params->session_attrs->iv_len); - if (params->session_attrs->iv_len == 12) - iv_ptr[15] = 1; - - op->sym->aead.data.offset = - params->session_attrs->aad_len; - op->sym->aead.data.length = params->symmetric_op->p_len; - - op->sym->m_src = m; - - return op; -} - -static struct rte_mbuf * -test_perf_create_pktmbuf_fill(struct rte_mempool *mpool, - struct perf_test_params *params, - unsigned buf_sz, struct crypto_params *m_hlp) -{ - struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); - uint16_t aad_len = params->session_attrs->aad_len; - uint16_t digest_size = params->symmetric_op->t_len; - char *p; - - p = rte_pktmbuf_append(m, aad_len); - if (p == NULL) { - rte_pktmbuf_free(m); - return NULL; - } - m_hlp->aad = (uint8_t *)p; - - p = rte_pktmbuf_append(m, buf_sz); - if (p == NULL) { - rte_pktmbuf_free(m); - return NULL; - } - rte_memcpy(p, params->symmetric_op->p_data, buf_sz); - - p = rte_pktmbuf_append(m, digest_size); - if (p == NULL) { - rte_pktmbuf_free(m); - return NULL; - } - m_hlp->digest = (uint8_t *)p; - - return m; -} - -static int -perf_AES_GCM(uint8_t dev_id, uint16_t queue_id, - struct perf_test_params *pparams, uint32_t test_ops) -{ - int j = 0; - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct rte_cryptodev_sym_session *sess; - struct rte_crypto_op *ops[pparams->burst_size]; - struct rte_crypto_op *proc_ops[pparams->burst_size]; - uint32_t total_operations = pparams->total_operations; - - uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0; - uint64_t processed = 0, failed_polls = 0, retries = 0; - uint64_t tsc_start = 0, tsc_end = 0; - - uint16_t i = 0, l = 0, m = 0; - uint16_t burst = pparams->burst_size * NUM_MBUF_SETS; - uint16_t ops_unused = 0; - - struct rte_mbuf *mbufs[burst]; - struct crypto_params m_hlp[burst]; - - if (rte_cryptodev_count() == 0) { - printf("\nNo crypto devices available. " - "Is kernel driver loaded?\n"); - return TEST_FAILED; - } - - sess = test_perf_create_session(dev_id, pparams); - TEST_ASSERT_NOT_NULL(sess, "Session creation failed"); - - for (i = 0; i < burst; i++) { - mbufs[i] = test_perf_create_pktmbuf_fill( - ts_params->mbuf_mp, - pparams, pparams->symmetric_op->p_len, - &m_hlp[i]); - } - - if (test_ops) - total_operations = test_ops; - - tsc_start = rte_rdtsc_precise(); - while (total_enqueued < total_operations) { - uint16_t burst_size = - total_enqueued+pparams->burst_size <= total_operations ? - pparams->burst_size : total_operations-total_enqueued; - uint16_t ops_needed = burst_size-ops_unused; - - if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool, - RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){ - printf("\nFailed to alloc enough ops, " - "finish dequeuing"); - } else { - for (i = 0; i < ops_needed; i++) - ops[i] = perf_gcm_set_crypto_op(ops[i], - mbufs[i + (pparams->burst_size * - (j % NUM_MBUF_SETS))], - sess, &m_hlp[i + (pparams->burst_size * - (j % NUM_MBUF_SETS))], pparams); - - /* enqueue burst */ - burst_enqueued = rte_cryptodev_enqueue_burst(dev_id, - queue_id, ops, burst_size); - - if (burst_enqueued < burst_size) - retries++; - - ops_unused = burst_size-burst_enqueued; - total_enqueued += burst_enqueued; - } - - /* dequeue burst */ - burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id, - proc_ops, pparams->burst_size); - if (burst_dequeued == 0) - failed_polls++; - else { - processed += burst_dequeued; - - for (l = 0; l < burst_dequeued; l++) - rte_crypto_op_free(proc_ops[l]); - } - - j++; - } - - /* Dequeue any operations still in the crypto device */ - while (processed < total_operations) { - /* Sending 0 length burst to flush sw crypto device */ - rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0); - - /* dequeue burst */ - burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id, - proc_ops, pparams->burst_size); - if (burst_dequeued == 0) - failed_polls++; - else { - processed += burst_dequeued; - - for (m = 0; m < burst_dequeued; m++) { - if (test_ops) { - uint8_t *pkt = rte_pktmbuf_mtod( - proc_ops[m]->sym->m_src, - uint8_t *); - - TEST_ASSERT_BUFFERS_ARE_EQUAL( - pparams->symmetric_op->c_data, - pkt + - pparams->session_attrs->aad_len, - pparams->symmetric_op->c_len, - "GCM Ciphertext data not as expected"); - - TEST_ASSERT_BUFFERS_ARE_EQUAL( - pparams->symmetric_op->t_data, - pkt + - pparams->session_attrs->aad_len + - pparams->symmetric_op->c_len, - pparams->symmetric_op->t_len, - "GCM MAC data not as expected"); - - } - rte_crypto_op_free(proc_ops[m]); - } - } - } - - tsc_end = rte_rdtsc_precise(); - - double ops_s = ((double)processed / (tsc_end - tsc_start)) - * rte_get_tsc_hz(); - double throughput = (ops_s * pparams->symmetric_op->p_len * 8) - / 1000000000; - - if (!test_ops) { - printf("\n%u\t\t%6.2f\t%16.2f\t%8"PRIu64"\t%10"PRIu64, - pparams->symmetric_op->p_len, - ops_s/1000000, throughput, retries, failed_polls); - } - - for (i = 0; i < burst; i++) - rte_pktmbuf_free(mbufs[i]); - - rte_cryptodev_sym_session_clear(ts_params->dev_id, sess); - rte_cryptodev_sym_session_free(sess); - - return 0; -} - -static int -test_perf_AES_GCM(int continual_buf_len, int continual_size) -{ - uint16_t i, j, k, loops = 1; - - uint16_t buf_lengths[] = { 64, 128, 256, 512, 1024, 1536, 2048 }; - - static const struct cryptodev_perf_test_data *gcm_tests[] = { - &AES_GCM_128_12IV_0AAD - }; - - if (continual_buf_len) - loops = continual_size; - - int TEST_CASES_GCM = RTE_DIM(gcm_tests); - - const unsigned burst_size = 32; - - struct symmetric_op ops_set[TEST_CASES_GCM]; - struct perf_test_params params_set[TEST_CASES_GCM]; - struct symmetric_session_attrs session_attrs[TEST_CASES_GCM]; - static const struct cryptodev_perf_test_data *gcm_test; - - for (i = 0; i < TEST_CASES_GCM; ++i) { - - gcm_test = gcm_tests[i]; - - session_attrs[i].aead = - RTE_CRYPTO_AEAD_OP_ENCRYPT; - session_attrs[i].aead_algorithm = - RTE_CRYPTO_AEAD_AES_GCM; - session_attrs[i].key_aead_data = - gcm_test->key.data; - session_attrs[i].key_aead_len = - gcm_test->key.len; - session_attrs[i].aad_len = gcm_test->aad.len; - session_attrs[i].digest_len = - gcm_test->auth_tag.len; - session_attrs[i].iv_len = gcm_test->iv.len; - session_attrs[i].iv_data = gcm_test->iv.data; - - ops_set[i].aad_data = gcm_test->aad.data; - ops_set[i].p_data = gcm_test->plaintext.data; - ops_set[i].p_len = buf_lengths[i]; - ops_set[i].c_data = gcm_test->ciphertext.data; - ops_set[i].c_len = buf_lengths[i]; - ops_set[i].t_data = gcm_test->auth_tags[i].data; - ops_set[i].t_len = gcm_test->auth_tags[i].len; - - params_set[i].chain = AEAD; - params_set[i].session_attrs = &session_attrs[i]; - params_set[i].symmetric_op = &ops_set[i]; - if (continual_buf_len) - params_set[i].total_operations = 0xFFFFFF; - else - params_set[i].total_operations = 1000000; - - params_set[i].burst_size = burst_size; - - } - - if (continual_buf_len) - printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub" - " burst size: %u", "AES_GCM", "AES_GCM", - gcm_test->key.len << 3, burst_size); - - for (i = 0; i < RTE_DIM(gcm_tests); i++) { - - if (!continual_buf_len) { - printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub" - " burst size: %u", "AES_GCM", "AES_GCM", - gcm_test->key.len << 3, burst_size); - printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t" - " Retries\tEmptyPolls"); - } - - uint16_t len = RTE_DIM(buf_lengths); - uint16_t p = 0; - - if (continual_buf_len) { - for (k = 0; k < RTE_DIM(buf_lengths); k++) - if (buf_lengths[k] == continual_buf_len) { - len = k + 1; - p = k; - break; - } - } - for (j = p; j < len; ++j) { - - params_set[i].symmetric_op->c_len = buf_lengths[j]; - params_set[i].symmetric_op->p_len = buf_lengths[j]; - - ops_set[i].t_data = gcm_tests[i]->auth_tags[j].data; - ops_set[i].t_len = gcm_tests[i]->auth_tags[j].len; - - /* Run is twice, one for encryption/hash checks, - * one for perf - */ - if (perf_AES_GCM(testsuite_params.dev_id, 0, - ¶ms_set[i], 1)) - return TEST_FAILED; - - for (k = 0; k < loops; k++) { - if (continual_buf_len) - printf("\n\nBuffer Size(B)\tOPS(M)\t" - "Throughput(Gbps)\t" - "Retries\tEmptyPolls"); - if (perf_AES_GCM(testsuite_params.dev_id, 0, - ¶ms_set[i], 0)) - return TEST_FAILED; - if (continual_buf_len) - printf("\n\nCompleted loop %i of %i ...", - k+1, loops); - } - } - - } - printf("\n"); - return 0; -} - -static int test_cryptodev_perf_AES_GCM(void) -{ - return test_perf_AES_GCM(0, 0); -} -/* - * This function calls AES GCM performance tests providing - * size of packet as an argument. If size of packet is not - * in the buf_lengths array, all sizes will be used - */ -static int test_continual_perf_AES_GCM(void) -{ - return test_perf_AES_GCM(1024, 10); -} - -static int -test_perf_continual_performance_test(void) -{ - unsigned int total_operations = 0xFFFFFF; - unsigned int total_loops = 10; - unsigned int burst_size = 32; - uint8_t i; - - struct perf_test_params params_set = { - .total_operations = total_operations, - .burst_size = burst_size, - .buf_size = 1024, - - .chain = CIPHER_HASH, - - .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC, - .key_length = 16, - .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC - }; - - for (i = 1; i <= total_loops; ++i) { - printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u." - " burst_size: %d ops\n", - chain_mode_name(params_set.chain), - rte_crypto_cipher_algorithm_strings[params_set.cipher_algo], - rte_crypto_auth_algorithm_strings[params_set.auth_algo], - params_set.key_length, - burst_size); - printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t" - "Retries\tEmptyPolls\n"); - test_perf_aes_sha(testsuite_params.dev_id, 0, - ¶ms_set); - printf("\nCompleted loop %i of %i ...", i, total_loops); - } - return 0; -} - -static struct unit_test_suite cryptodev_qat_continual_testsuite = { - .suite_name = "Crypto Device Continual Performance Test", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_continual_performance_test), - TEST_CASE_ST(ut_setup, ut_teardown, - test_continual_perf_AES_GCM), - TEST_CASES_END() /**< NULL terminate unit test array */ - } -}; - -static struct unit_test_suite cryptodev_testsuite = { - .suite_name = "Crypto Device Unit Test Suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_aes_cbc_encrypt_digest_vary_pkt_size), - TEST_CASE_ST(ut_setup, ut_teardown, - test_cryptodev_perf_AES_GCM), - TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_aes_cbc_vary_burst_size), - TEST_CASES_END() /**< NULL terminate unit test array */ - } -}; - -static struct unit_test_suite cryptodev_dpaa2_sec_testsuite = { - .suite_name = "Crypto Device DPAA2_SEC Unit Test Suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_aes_cbc_encrypt_digest_vary_pkt_size), - TEST_CASES_END() /**< NULL terminate unit test array */ - } -}; - -static struct unit_test_suite cryptodev_gcm_testsuite = { - .suite_name = "Crypto Device AESNI GCM Unit Test Suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(ut_setup, ut_teardown, - test_cryptodev_perf_AES_GCM), - TEST_CASES_END() /**< NULL terminate unit test array */ - } -}; - -static struct unit_test_suite cryptodev_aes_testsuite = { - .suite_name = "Crypto Device AESNI MB Unit Test Suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_aes_cbc_encrypt_digest_vary_pkt_size), - TEST_CASES_END() /**< NULL terminate unit test array */ - } -}; - -static struct unit_test_suite cryptodev_snow3g_testsuite = { - .suite_name = "Crypto Device SNOW3G Unit Test Suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_snow3G_vary_pkt_size), - TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_snow3G_vary_burst_size), - TEST_CASES_END() /**< NULL terminate unit test array */ - } -}; - -static struct unit_test_suite cryptodev_openssl_testsuite = { - .suite_name = "Crypto Device OPENSSL Unit Test Suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_openssl_vary_pkt_size), - TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_openssl_vary_burst_size), - TEST_CASES_END() /**< NULL terminate unit test array */ - } -}; - -static struct unit_test_suite cryptodev_armv8_testsuite = { - .suite_name = "Crypto Device ARMv8 Unit Test Suite", - .setup = testsuite_setup, - .teardown = testsuite_teardown, - .unit_test_cases = { - TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_armv8_vary_pkt_size), - TEST_CASE_ST(ut_setup, ut_teardown, - test_perf_armv8_vary_burst_size), - TEST_CASES_END() /**< NULL terminate unit test array */ - } -}; - -static int -perftest_aesni_gcm_cryptodev(void) -{ - gbl_driver_id = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD)); - - if (gbl_driver_id == -1) { - RTE_LOG(ERR, USER1, "AESNI GCM PMD must be loaded. Check if " - "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM is enabled " - "in config file to run this testsuite.\n"); - return TEST_FAILED; - } - - return unit_test_suite_runner(&cryptodev_gcm_testsuite); -} - -static int -perftest_aesni_mb_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) -{ - gbl_driver_id = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); - - if (gbl_driver_id == -1) { - RTE_LOG(ERR, USER1, "AESNI MB PMD must be loaded. Check if " - "CONFIG_RTE_LIBRTE_PMD_AESNI_MB is enabled " - "in config file to run this testsuite.\n"); - return TEST_FAILED; - } - - return unit_test_suite_runner(&cryptodev_aes_testsuite); -} - -static int -perftest_qat_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) -{ - gbl_driver_id = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); - - if (gbl_driver_id == -1) { - RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if " - "CONFIG_RTE_LIBRTE_PMD_QAT is enabled " - "in config file to run this testsuite.\n"); - return TEST_FAILED; - } - - return unit_test_suite_runner(&cryptodev_testsuite); -} - -static int -perftest_sw_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) -{ - gbl_driver_id = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)); - - if (gbl_driver_id == -1) { - RTE_LOG(ERR, USER1, "SNOW3G PMD must be loaded. Check if " - "CONFIG_RTE_LIBRTE_PMD_SNOW3G is enabled " - "in config file to run this testsuite.\n"); - return TEST_FAILED; - } - - return unit_test_suite_runner(&cryptodev_snow3g_testsuite); -} - -static int -perftest_qat_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) -{ - gbl_driver_id = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); - - if (gbl_driver_id == -1) { - RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if " - "CONFIG_RTE_LIBRTE_PMD_QAT is enabled " - "in config file to run this testsuite.\n"); - return TEST_FAILED; - } - - return unit_test_suite_runner(&cryptodev_snow3g_testsuite); -} - -static int -perftest_openssl_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) -{ - gbl_driver_id = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)); - - if (gbl_driver_id == -1) { - RTE_LOG(ERR, USER1, "OpenSSL PMD must be loaded. Check if " - "CONFIG_RTE_LIBRTE_PMD_OPENSSL is enabled " - "in config file to run this testsuite.\n"); - return TEST_FAILED; - } - - return unit_test_suite_runner(&cryptodev_openssl_testsuite); -} - -static int -perftest_qat_continual_cryptodev(void) -{ - gbl_driver_id = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); - - if (gbl_driver_id == -1) { - RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if " - "CONFIG_RTE_LIBRTE_PMD_QAT is enabled " - "in config file to run this testsuite.\n"); - return TEST_FAILED; - } - - return unit_test_suite_runner(&cryptodev_qat_continual_testsuite); -} - -static int -perftest_sw_armv8_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/) -{ - gbl_driver_id = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)); - - if (gbl_driver_id == -1) { - RTE_LOG(ERR, USER1, "ARMV8 PMD must be loaded. Check if " - "CONFIG_RTE_LIBRTE_PMD_ARMV8 is enabled " - "in config file to run this testsuite.\n"); - return TEST_FAILED; - } - - return unit_test_suite_runner(&cryptodev_armv8_testsuite); -} - -static int -perftest_dpaa2_sec_cryptodev(void) -{ - gbl_driver_id = rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)); - - if (gbl_driver_id == -1) { - RTE_LOG(ERR, USER1, "DPAA2 SEC PMD must be loaded. Check if " - "CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC is enabled " - "in config file to run this testsuite.\n"); - return TEST_FAILED; - } - - return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite); -} - -REGISTER_TEST_COMMAND(cryptodev_aesni_mb_perftest, perftest_aesni_mb_cryptodev); -REGISTER_TEST_COMMAND(cryptodev_qat_perftest, perftest_qat_cryptodev); -REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_perftest, perftest_sw_snow3g_cryptodev); -REGISTER_TEST_COMMAND(cryptodev_qat_snow3g_perftest, perftest_qat_snow3g_cryptodev); -REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_perftest, perftest_aesni_gcm_cryptodev); -REGISTER_TEST_COMMAND(cryptodev_openssl_perftest, - perftest_openssl_cryptodev); -REGISTER_TEST_COMMAND(cryptodev_qat_continual_perftest, - perftest_qat_continual_cryptodev); -REGISTER_TEST_COMMAND(cryptodev_sw_armv8_perftest, - perftest_sw_armv8_cryptodev); -REGISTER_TEST_COMMAND(cryptodev_dpaa2_sec_perftest, - perftest_dpaa2_sec_cryptodev); diff --git a/test/test/test_eal_flags.c b/test/test/test_eal_flags.c index 594d79d7..310109e6 100644 --- a/test/test/test_eal_flags.c +++ b/test/test/test_eal_flags.c @@ -51,11 +51,7 @@ #include "process.h" -#ifdef RTE_LIBRTE_XEN_DOM0 -#define DEFAULT_MEM_SIZE "30" -#else #define DEFAULT_MEM_SIZE "18" -#endif #define mp_flag "--proc-type=secondary" #define no_hpet "--no-hpet" #define no_huge "--no-huge" @@ -809,72 +805,6 @@ test_no_huge_flag(void) return 0; } -#ifdef RTE_LIBRTE_XEN_DOM0 -static int -test_dom0_misc_flags(void) -{ - char prefix[PATH_MAX], tmp[PATH_MAX]; - - if (get_current_prefix(tmp, sizeof(tmp)) == NULL) { - printf("Error - unable to get current prefix!\n"); - return -1; - } - snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp); - - /* check that some general flags don't prevent things from working. - * All cases, apart from the first, app should run. - * No further testing of output done. - */ - /* sanity check - failure with invalid option */ - const char *argv0[] = {prgname, prefix, mp_flag, "-c", "1", "--invalid-opt"}; - - /* With --no-pci */ - const char *argv1[] = {prgname, prefix, mp_flag, "-c", "1", "--no-pci"}; - /* With -v */ - const char *argv2[] = {prgname, prefix, mp_flag, "-c", "1", "-v"}; - /* With valid --syslog */ - const char *argv3[] = {prgname, prefix, mp_flag, "-c", "1", - "--syslog", "syslog"}; - /* With empty --syslog (should fail) */ - const char *argv4[] = {prgname, prefix, mp_flag, "-c", "1", "--syslog"}; - /* With invalid --syslog */ - const char *argv5[] = {prgname, prefix, mp_flag, "-c", "1", "--syslog", "error"}; - /* With no-sh-conf */ - const char *argv6[] = {prgname, "-c", "1", "-n", "2", "-m", "20", - "--no-shconf", "--file-prefix=noshconf" }; - - if (launch_proc(argv0) == 0) { - printf("Error - process ran ok with invalid flag\n"); - return -1; - } - if (launch_proc(argv1) != 0) { - printf("Error - process did not run ok with --no-pci flag\n"); - return -1; - } - if (launch_proc(argv2) != 0) { - printf("Error - process did not run ok with -v flag\n"); - return -1; - } - if (launch_proc(argv3) != 0) { - printf("Error - process did not run ok with --syslog flag\n"); - return -1; - } - if (launch_proc(argv4) == 0) { - printf("Error - process run ok with empty --syslog flag\n"); - return -1; - } - if (launch_proc(argv5) == 0) { - printf("Error - process run ok with invalid --syslog flag\n"); - return -1; - } - if (launch_proc(argv6) != 0) { - printf("Error - process did not run ok with --no-shconf flag\n"); - return -1; - } - - return 0; -} -#else static int test_misc_flags(void) { @@ -1061,7 +991,6 @@ test_misc_flags(void) } return 0; } -#endif static int test_file_prefix(void) @@ -1098,9 +1027,6 @@ test_file_prefix(void) printf("Error - unable to get current prefix!\n"); return -1; } -#ifdef RTE_LIBRTE_XEN_DOM0 - return 0; -#endif /* check if files for current prefix are present */ if (process_hugefiles(prefix, HUGEPAGE_CHECK_EXISTS) != 1) { @@ -1299,9 +1225,6 @@ test_memory_flags(void) printf("Error - process failed with valid -m flag!\n"); return -1; } -#ifdef RTE_LIBRTE_XEN_DOM0 - return 0; -#endif if (launch_proc(argv2) == 0) { printf("Error - process run ok with invalid (zero) --socket-mem!\n"); return -1; @@ -1427,11 +1350,7 @@ test_eal_flags(void) return ret; } -#ifdef RTE_LIBRTE_XEN_DOM0 - ret = test_dom0_misc_flags(); -#else ret = test_misc_flags(); -#endif if (ret < 0) { printf("Error in test_misc_flags()"); return ret; diff --git a/test/test/test_event_eth_rx_adapter.c b/test/test/test_event_eth_rx_adapter.c new file mode 100644 index 00000000..90a5c646 --- /dev/null +++ b/test/test/test_event_eth_rx_adapter.c @@ -0,0 +1,454 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2017 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include <string.h> +#include <rte_common.h> +#include <rte_mempool.h> +#include <rte_mbuf.h> +#include <rte_ethdev.h> +#include <rte_eventdev.h> +#include <rte_bus_vdev.h> + +#include <rte_event_eth_rx_adapter.h> + +#include "test.h" + +#define MAX_NUM_RX_QUEUE 64 +#define NB_MBUFS (8192 * num_ports * MAX_NUM_RX_QUEUE) +#define MBUF_CACHE_SIZE 512 +#define MBUF_PRIV_SIZE 0 +#define TEST_INST_ID 0 +#define TEST_DEV_ID 0 +#define TEST_ETHDEV_ID 0 + +struct event_eth_rx_adapter_test_params { + struct rte_mempool *mp; + uint16_t rx_rings, tx_rings; + uint32_t caps; +}; + +static struct event_eth_rx_adapter_test_params default_params; + +static inline int +port_init(uint8_t port, struct rte_mempool *mp) +{ + static const struct rte_eth_conf port_conf_default = { + .rxmode = { + .mq_mode = ETH_MQ_RX_RSS, + .max_rx_pkt_len = ETHER_MAX_LEN + }, + .rx_adv_conf = { + .rss_conf = { + .rss_hf = ETH_RSS_IP | + ETH_RSS_TCP | + ETH_RSS_UDP, + } + } + }; + const uint16_t rx_ring_size = 512, tx_ring_size = 512; + struct rte_eth_conf port_conf = port_conf_default; + int retval; + uint16_t q; + struct rte_eth_dev_info dev_info; + + if (port >= rte_eth_dev_count()) + return -1; + + retval = rte_eth_dev_configure(port, 0, 0, &port_conf); + + rte_eth_dev_info_get(port, &dev_info); + + default_params.rx_rings = RTE_MIN(dev_info.max_rx_queues, + MAX_NUM_RX_QUEUE); + default_params.tx_rings = 1; + + /* Configure the Ethernet device. */ + retval = rte_eth_dev_configure(port, default_params.rx_rings, + default_params.tx_rings, &port_conf); + if (retval != 0) + return retval; + + for (q = 0; q < default_params.rx_rings; q++) { + retval = rte_eth_rx_queue_setup(port, q, rx_ring_size, + rte_eth_dev_socket_id(port), NULL, mp); + if (retval < 0) + return retval; + } + + /* Allocate and set up 1 TX queue per Ethernet port. */ + for (q = 0; q < default_params.tx_rings; q++) { + retval = rte_eth_tx_queue_setup(port, q, tx_ring_size, + rte_eth_dev_socket_id(port), NULL); + if (retval < 0) + return retval; + } + + /* Start the Ethernet port. */ + retval = rte_eth_dev_start(port); + if (retval < 0) + return retval; + + /* Display the port MAC address. */ + struct ether_addr addr; + rte_eth_macaddr_get(port, &addr); + printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 + " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", + (unsigned int)port, + addr.addr_bytes[0], addr.addr_bytes[1], + addr.addr_bytes[2], addr.addr_bytes[3], + addr.addr_bytes[4], addr.addr_bytes[5]); + + /* Enable RX in promiscuous mode for the Ethernet device. */ + rte_eth_promiscuous_enable(port); + + return 0; +} + +static int +init_ports(int num_ports) +{ + uint8_t portid; + int retval; + + default_params.mp = rte_pktmbuf_pool_create("packet_pool", + NB_MBUFS, + MBUF_CACHE_SIZE, + MBUF_PRIV_SIZE, + RTE_MBUF_DEFAULT_BUF_SIZE, + rte_socket_id()); + if (!default_params.mp) + return -ENOMEM; + + for (portid = 0; portid < num_ports; portid++) { + retval = port_init(portid, default_params.mp); + if (retval) + return retval; + } + + return 0; +} + +static int +testsuite_setup(void) +{ + int err; + uint8_t count; + struct rte_event_dev_info dev_info; + + count = rte_event_dev_count(); + if (!count) { + printf("Failed to find a valid event device," + " testing with event_skeleton device\n"); + rte_vdev_init("event_skeleton", NULL); + } + + struct rte_event_dev_config config = { + .nb_event_queues = 1, + .nb_event_ports = 1, + }; + + err = rte_event_dev_info_get(TEST_DEV_ID, &dev_info); + config.nb_event_queue_flows = dev_info.max_event_queue_flows; + config.nb_event_port_dequeue_depth = + dev_info.max_event_port_dequeue_depth; + config.nb_event_port_enqueue_depth = + dev_info.max_event_port_enqueue_depth; + config.nb_events_limit = + dev_info.max_num_events; + err = rte_event_dev_configure(TEST_DEV_ID, &config); + TEST_ASSERT(err == 0, "Event device initialization failed err %d\n", + err); + + /* + * eth devices like octeontx use event device to receive packets + * so rte_eth_dev_start invokes rte_event_dev_start internally, so + * call init_ports after rte_event_dev_configure + */ + err = init_ports(rte_eth_dev_count()); + TEST_ASSERT(err == 0, "Port initialization failed err %d\n", err); + + err = rte_event_eth_rx_adapter_caps_get(TEST_DEV_ID, TEST_ETHDEV_ID, + &default_params.caps); + TEST_ASSERT(err == 0, "Failed to get adapter cap err %d\n", + err); + + return err; +} + +static void +testsuite_teardown(void) +{ + uint32_t i; + for (i = 0; i < rte_eth_dev_count(); i++) + rte_eth_dev_stop(i); + + rte_mempool_free(default_params.mp); +} + +static int +adapter_create(void) +{ + int err; + struct rte_event_dev_info dev_info; + struct rte_event_port_conf rx_p_conf; + + err = rte_event_dev_info_get(TEST_DEV_ID, &dev_info); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + rx_p_conf.new_event_threshold = dev_info.max_num_events; + rx_p_conf.dequeue_depth = dev_info.max_event_port_dequeue_depth; + rx_p_conf.enqueue_depth = dev_info.max_event_port_enqueue_depth; + err = rte_event_eth_rx_adapter_create(TEST_INST_ID, TEST_DEV_ID, + &rx_p_conf); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + return err; +} + +static void +adapter_free(void) +{ + rte_event_eth_rx_adapter_free(TEST_INST_ID); +} + +static int +adapter_create_free(void) +{ + int err; + + struct rte_event_port_conf rx_p_conf = { + .dequeue_depth = 8, + .enqueue_depth = 8, + .new_event_threshold = 1200, + }; + + err = rte_event_eth_rx_adapter_create(TEST_INST_ID, TEST_DEV_ID, + NULL); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_rx_adapter_create(TEST_INST_ID, TEST_DEV_ID, + &rx_p_conf); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_create(TEST_INST_ID, + TEST_DEV_ID, &rx_p_conf); + TEST_ASSERT(err == -EEXIST, "Expected -EEXIST %d got %d", -EEXIST, err); + + err = rte_event_eth_rx_adapter_free(TEST_INST_ID); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_free(TEST_INST_ID); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL %d got %d", -EINVAL, err); + + err = rte_event_eth_rx_adapter_free(1); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL %d got %d", -EINVAL, err); + + return TEST_SUCCESS; +} + +static int +adapter_queue_add_del(void) +{ + int err; + struct rte_event ev; + uint32_t cap; + + struct rte_event_eth_rx_adapter_queue_conf queue_config; + + err = rte_event_eth_rx_adapter_caps_get(TEST_DEV_ID, TEST_ETHDEV_ID, + &cap); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + ev.queue_id = 0; + ev.sched_type = RTE_SCHED_TYPE_ATOMIC; + ev.priority = 0; + + queue_config.rx_queue_flags = 0; + if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) { + ev.flow_id = 1; + queue_config.rx_queue_flags = + RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID; + } + queue_config.ev = ev; + queue_config.servicing_weight = 1; + + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + rte_eth_dev_count(), + -1, &queue_config); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ) { + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, 0, + &queue_config); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID, + TEST_ETHDEV_ID, 0); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + -1, + &queue_config); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID, + TEST_ETHDEV_ID, + -1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + } else { + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + 0, + &queue_config); + TEST_ASSERT(err == -EINVAL, "Expected EINVAL got %d", err); + + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, -1, + &queue_config); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID, + TEST_ETHDEV_ID, 0); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID, + TEST_ETHDEV_ID, -1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID, + TEST_ETHDEV_ID, -1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + } + + err = rte_event_eth_rx_adapter_queue_add(1, TEST_ETHDEV_ID, -1, + &queue_config); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_rx_adapter_queue_del(1, TEST_ETHDEV_ID, -1); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + return TEST_SUCCESS; +} + +static int +adapter_start_stop(void) +{ + int err; + struct rte_event ev; + + ev.queue_id = 0; + ev.sched_type = RTE_SCHED_TYPE_ATOMIC; + ev.priority = 0; + + struct rte_event_eth_rx_adapter_queue_conf queue_config; + + queue_config.rx_queue_flags = 0; + if (default_params.caps & + RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) { + ev.flow_id = 1; + queue_config.rx_queue_flags = + RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID; + } + + queue_config.ev = ev; + queue_config.servicing_weight = 1; + + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, TEST_ETHDEV_ID, + -1, &queue_config); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_start(TEST_INST_ID); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_stop(TEST_INST_ID); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID, TEST_ETHDEV_ID, + -1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_start(TEST_INST_ID); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_stop(TEST_INST_ID); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_start(1); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_rx_adapter_stop(1); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + return TEST_SUCCESS; +} + +static int +adapter_stats(void) +{ + int err; + struct rte_event_eth_rx_adapter_stats stats; + + err = rte_event_eth_rx_adapter_stats_get(TEST_INST_ID, NULL); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_rx_adapter_stats_get(TEST_INST_ID, &stats); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_stats_get(1, &stats); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + return TEST_SUCCESS; +} + +static struct unit_test_suite service_tests = { + .suite_name = "rx event eth adapter test suite", + .setup = testsuite_setup, + .teardown = testsuite_teardown, + .unit_test_cases = { + TEST_CASE_ST(NULL, NULL, adapter_create_free), + TEST_CASE_ST(adapter_create, adapter_free, + adapter_queue_add_del), + TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop), + TEST_CASE_ST(adapter_create, adapter_free, adapter_stats), + TEST_CASES_END() /**< NULL terminate unit test array */ + } +}; + +static int +test_event_eth_rx_adapter_common(void) +{ + return unit_test_suite_runner(&service_tests); +} + +REGISTER_TEST_COMMAND(event_eth_rx_adapter_autotest, + test_event_eth_rx_adapter_common); diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c index f766191e..ba39cbac 100644 --- a/test/test/test_eventdev.c +++ b/test/test/test_eventdev.c @@ -37,6 +37,7 @@ #include <rte_memcpy.h> #include <rte_eventdev.h> #include <rte_dev.h> +#include <rte_bus_vdev.h> #include "test.h" @@ -273,7 +274,12 @@ test_eventdev_queue_default_conf_get(void) ret = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, NULL); TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); - for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) { + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); + + for (i = 0; i < (int)queue_count; i++) { ret = rte_event_queue_default_conf_get(TEST_DEV_ID, i, &qconf); TEST_ASSERT_SUCCESS(ret, "Failed to get queue%d info", i); @@ -295,15 +301,13 @@ test_eventdev_queue_setup(void) /* Negative cases */ ret = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, &qconf); TEST_ASSERT_SUCCESS(ret, "Failed to get queue0 info"); - qconf.event_queue_cfg = (RTE_EVENT_QUEUE_CFG_ALL_TYPES & - RTE_EVENT_QUEUE_CFG_TYPE_MASK); + qconf.event_queue_cfg = RTE_EVENT_QUEUE_CFG_ALL_TYPES; qconf.nb_atomic_flows = info.max_event_queue_flows + 1; ret = rte_event_queue_setup(TEST_DEV_ID, 0, &qconf); TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); qconf.nb_atomic_flows = info.max_event_queue_flows; - qconf.event_queue_cfg = (RTE_EVENT_QUEUE_CFG_ORDERED_ONLY & - RTE_EVENT_QUEUE_CFG_TYPE_MASK); + qconf.schedule_type = RTE_SCHED_TYPE_ORDERED; qconf.nb_atomic_order_sequences = info.max_event_queue_flows + 1; ret = rte_event_queue_setup(TEST_DEV_ID, 0, &qconf); TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); @@ -318,8 +322,12 @@ test_eventdev_queue_setup(void) ret = rte_event_queue_setup(TEST_DEV_ID, 0, &qconf); TEST_ASSERT_SUCCESS(ret, "Failed to setup queue0"); + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); - for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) { + for (i = 0; i < (int)queue_count; i++) { ret = rte_event_queue_setup(TEST_DEV_ID, i, NULL); TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i); } @@ -336,14 +344,18 @@ test_eventdev_queue_count(void) ret = rte_event_dev_info_get(TEST_DEV_ID, &info); TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); - TEST_ASSERT_EQUAL(rte_event_queue_count(TEST_DEV_ID), - info.max_event_queues, "Wrong queue count"); + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); + TEST_ASSERT_EQUAL(queue_count, info.max_event_queues, + "Wrong queue count"); return TEST_SUCCESS; } static int -test_eventdev_queue_priority(void) +test_eventdev_queue_attr_priority(void) { int i, ret; struct rte_event_dev_info info; @@ -353,7 +365,12 @@ test_eventdev_queue_priority(void) ret = rte_event_dev_info_get(TEST_DEV_ID, &info); TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); - for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) { + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); + + for (i = 0; i < (int)queue_count; i++) { ret = rte_event_queue_default_conf_get(TEST_DEV_ID, i, &qconf); TEST_ASSERT_SUCCESS(ret, "Failed to get queue%d def conf", i); @@ -362,8 +379,13 @@ test_eventdev_queue_priority(void) TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i); } - for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) { - priority = rte_event_queue_priority(TEST_DEV_ID, i); + for (i = 0; i < (int)queue_count; i++) { + uint32_t tmp; + TEST_ASSERT_SUCCESS(rte_event_queue_attr_get(TEST_DEV_ID, i, + RTE_EVENT_QUEUE_ATTR_PRIORITY, &tmp), + "Queue priority get failed"); + priority = tmp; + if (info.event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS) TEST_ASSERT_EQUAL(priority, i % RTE_EVENT_DEV_PRIORITY_LOWEST, @@ -378,6 +400,134 @@ test_eventdev_queue_priority(void) } static int +test_eventdev_queue_attr_nb_atomic_flows(void) +{ + int i, ret; + struct rte_event_dev_info info; + struct rte_event_queue_conf qconf; + uint32_t nb_atomic_flows; + + ret = rte_event_dev_info_get(TEST_DEV_ID, &info); + TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); + + ret = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, &qconf); + TEST_ASSERT_SUCCESS(ret, "Failed to get queue 0's def conf"); + + if (qconf.nb_atomic_flows == 0) + /* Assume PMD doesn't support atomic flows, return early */ + return -ENOTSUP; + + qconf.schedule_type = RTE_SCHED_TYPE_ATOMIC; + + for (i = 0; i < (int)queue_count; i++) { + ret = rte_event_queue_setup(TEST_DEV_ID, i, &qconf); + TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i); + } + + for (i = 0; i < (int)queue_count; i++) { + TEST_ASSERT_SUCCESS(rte_event_queue_attr_get(TEST_DEV_ID, i, + RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS, + &nb_atomic_flows), + "Queue nb_atomic_flows get failed"); + + TEST_ASSERT_EQUAL(nb_atomic_flows, qconf.nb_atomic_flows, + "Wrong atomic flows value for queue%d", i); + } + + return TEST_SUCCESS; +} + +static int +test_eventdev_queue_attr_nb_atomic_order_sequences(void) +{ + int i, ret; + struct rte_event_dev_info info; + struct rte_event_queue_conf qconf; + uint32_t nb_atomic_order_sequences; + + ret = rte_event_dev_info_get(TEST_DEV_ID, &info); + TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); + + ret = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, &qconf); + TEST_ASSERT_SUCCESS(ret, "Failed to get queue 0's def conf"); + + if (qconf.nb_atomic_order_sequences == 0) + /* Assume PMD doesn't support reordering */ + return -ENOTSUP; + + qconf.schedule_type = RTE_SCHED_TYPE_ORDERED; + + for (i = 0; i < (int)queue_count; i++) { + ret = rte_event_queue_setup(TEST_DEV_ID, i, &qconf); + TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i); + } + + for (i = 0; i < (int)queue_count; i++) { + TEST_ASSERT_SUCCESS(rte_event_queue_attr_get(TEST_DEV_ID, i, + RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES, + &nb_atomic_order_sequences), + "Queue nb_atomic_order_sequencess get failed"); + + TEST_ASSERT_EQUAL(nb_atomic_order_sequences, + qconf.nb_atomic_order_sequences, + "Wrong atomic order sequences value for queue%d", + i); + } + + return TEST_SUCCESS; +} + +static int +test_eventdev_queue_attr_event_queue_cfg(void) +{ + int i, ret; + struct rte_event_dev_info info; + struct rte_event_queue_conf qconf; + uint32_t event_queue_cfg; + + ret = rte_event_dev_info_get(TEST_DEV_ID, &info); + TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); + + ret = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, &qconf); + TEST_ASSERT_SUCCESS(ret, "Failed to get queue0 def conf"); + + qconf.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK; + + for (i = 0; i < (int)queue_count; i++) { + ret = rte_event_queue_setup(TEST_DEV_ID, i, &qconf); + TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i); + } + + for (i = 0; i < (int)queue_count; i++) { + TEST_ASSERT_SUCCESS(rte_event_queue_attr_get(TEST_DEV_ID, i, + RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG, + &event_queue_cfg), + "Queue event_queue_cfg get failed"); + + TEST_ASSERT_EQUAL(event_queue_cfg, qconf.event_queue_cfg, + "Wrong event_queue_cfg value for queue%d", + i); + } + + return TEST_SUCCESS; +} + +static int test_eventdev_port_default_conf_get(void) { int i, ret; @@ -386,11 +536,16 @@ test_eventdev_port_default_conf_get(void) ret = rte_event_port_default_conf_get(TEST_DEV_ID, 0, NULL); TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); + uint32_t port_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &port_count), "Port count get failed"); + ret = rte_event_port_default_conf_get(TEST_DEV_ID, - rte_event_port_count(TEST_DEV_ID) + 1, NULL); + port_count + 1, NULL); TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); - for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) { + for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_default_conf_get(TEST_DEV_ID, i, &pconf); TEST_ASSERT_SUCCESS(ret, "Failed to get port%d info", i); @@ -436,8 +591,12 @@ test_eventdev_port_setup(void) ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf); TEST_ASSERT_SUCCESS(ret, "Failed to setup port0"); + uint32_t port_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &port_count), "Port count get failed"); - for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) { + for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_setup(TEST_DEV_ID, i, NULL); TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i); } @@ -446,7 +605,32 @@ test_eventdev_port_setup(void) } static int -test_eventdev_dequeue_depth(void) +test_eventdev_port_attr_dequeue_depth(void) +{ + int ret; + struct rte_event_dev_info info; + struct rte_event_port_conf pconf; + + ret = rte_event_dev_info_get(TEST_DEV_ID, &info); + TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); + + ret = rte_event_port_default_conf_get(TEST_DEV_ID, 0, &pconf); + TEST_ASSERT_SUCCESS(ret, "Failed to get port0 info"); + ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf); + TEST_ASSERT_SUCCESS(ret, "Failed to setup port0"); + + uint32_t value; + TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0, + RTE_EVENT_PORT_ATTR_DEQ_DEPTH, &value), + 0, "Call to get port dequeue depth failed"); + TEST_ASSERT_EQUAL(value, pconf.dequeue_depth, + "Wrong port dequeue depth"); + + return TEST_SUCCESS; +} + +static int +test_eventdev_port_attr_enqueue_depth(void) { int ret; struct rte_event_dev_info info; @@ -460,14 +644,18 @@ test_eventdev_dequeue_depth(void) ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf); TEST_ASSERT_SUCCESS(ret, "Failed to setup port0"); - TEST_ASSERT_EQUAL(rte_event_port_dequeue_depth(TEST_DEV_ID, 0), - pconf.dequeue_depth, "Wrong port dequeue depth"); + uint32_t value; + TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0, + RTE_EVENT_PORT_ATTR_ENQ_DEPTH, &value), + 0, "Call to get port enqueue depth failed"); + TEST_ASSERT_EQUAL(value, pconf.enqueue_depth, + "Wrong port enqueue depth"); return TEST_SUCCESS; } static int -test_eventdev_enqueue_depth(void) +test_eventdev_port_attr_new_event_threshold(void) { int ret; struct rte_event_dev_info info; @@ -481,8 +669,12 @@ test_eventdev_enqueue_depth(void) ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf); TEST_ASSERT_SUCCESS(ret, "Failed to setup port0"); - TEST_ASSERT_EQUAL(rte_event_port_enqueue_depth(TEST_DEV_ID, 0), - pconf.enqueue_depth, "Wrong port enqueue depth"); + uint32_t value; + TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0, + RTE_EVENT_PORT_ATTR_NEW_EVENT_THRESHOLD, &value), + 0, "Call to get port new event threshold failed"); + TEST_ASSERT_EQUAL((int32_t) value, pconf.new_event_threshold, + "Wrong port new event threshold"); return TEST_SUCCESS; } @@ -496,8 +688,11 @@ test_eventdev_port_count(void) ret = rte_event_dev_info_get(TEST_DEV_ID, &info); TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); - TEST_ASSERT_EQUAL(rte_event_port_count(TEST_DEV_ID), - info.max_event_ports, "Wrong port count"); + uint32_t port_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &port_count), "Port count get failed"); + TEST_ASSERT_EQUAL(port_count, info.max_event_ports, "Wrong port count"); return TEST_SUCCESS; } @@ -524,19 +719,28 @@ test_eventdev_start_stop(void) ret = eventdev_configure_setup(); TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); - for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) { + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); + for (i = 0; i < (int)queue_count; i++) { ret = rte_event_queue_setup(TEST_DEV_ID, i, NULL); TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i); } - for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) { + uint32_t port_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &port_count), "Port count get failed"); + + for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_setup(TEST_DEV_ID, i, NULL); TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i); } ret = rte_event_port_link(TEST_DEV_ID, 0, NULL, NULL, 0); - TEST_ASSERT(ret == rte_event_queue_count(TEST_DEV_ID), - "Failed to link port, device %d", TEST_DEV_ID); + TEST_ASSERT(ret == (int)queue_count, "Failed to link port, device %d", + TEST_DEV_ID); ret = rte_event_dev_start(TEST_DEV_ID); TEST_ASSERT_SUCCESS(ret, "Failed to start device%d", TEST_DEV_ID); @@ -554,19 +758,28 @@ eventdev_setup_device(void) ret = eventdev_configure_setup(); TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); - for (i = 0; i < rte_event_queue_count(TEST_DEV_ID); i++) { + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); + for (i = 0; i < (int)queue_count; i++) { ret = rte_event_queue_setup(TEST_DEV_ID, i, NULL); TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i); } - for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) { + uint32_t port_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &port_count), "Port count get failed"); + + for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_setup(TEST_DEV_ID, i, NULL); TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i); } ret = rte_event_port_link(TEST_DEV_ID, 0, NULL, NULL, 0); - TEST_ASSERT(ret == rte_event_queue_count(TEST_DEV_ID), - "Failed to link port, device %d", TEST_DEV_ID); + TEST_ASSERT(ret == (int)queue_count, "Failed to link port, device %d", + TEST_DEV_ID); ret = rte_event_dev_start(TEST_DEV_ID); TEST_ASSERT_SUCCESS(ret, "Failed to start device%d", TEST_DEV_ID); @@ -591,7 +804,11 @@ test_eventdev_link(void) TEST_ASSERT(ret >= 0, "Failed to link with NULL device%d", TEST_DEV_ID); - nb_queues = rte_event_queue_count(TEST_DEV_ID); + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); + nb_queues = queue_count; for (i = 0; i < nb_queues; i++) { queues[i] = i; priorities[i] = RTE_EVENT_DEV_PRIORITY_NORMAL; @@ -614,7 +831,11 @@ test_eventdev_unlink(void) TEST_ASSERT(ret >= 0, "Failed to unlink with NULL device%d", TEST_DEV_ID); - nb_queues = rte_event_queue_count(TEST_DEV_ID); + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); + nb_queues = queue_count; for (i = 0; i < nb_queues; i++) queues[i] = i; @@ -628,7 +849,7 @@ test_eventdev_unlink(void) static int test_eventdev_link_get(void) { - int ret, nb_queues, i; + int ret, i; uint8_t queues[RTE_EVENT_MAX_QUEUES_PER_DEV]; uint8_t priorities[RTE_EVENT_MAX_QUEUES_PER_DEV]; @@ -637,7 +858,11 @@ test_eventdev_link_get(void) TEST_ASSERT(ret >= 0, "Failed to link with NULL device%d", TEST_DEV_ID); - nb_queues = rte_event_queue_count(TEST_DEV_ID); + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), + "Queue count get failed"); + const int nb_queues = queue_count; for (i = 0; i < nb_queues; i++) queues[i] = i; @@ -649,7 +874,6 @@ test_eventdev_link_get(void) TEST_ASSERT(ret == 0, "(%d)Wrong link get=%d", TEST_DEV_ID, ret); /* link all queues and get the links */ - nb_queues = rte_event_queue_count(TEST_DEV_ID); for (i = 0; i < nb_queues; i++) { queues[i] = i; priorities[i] = RTE_EVENT_DEV_PRIORITY_NORMAL; @@ -679,8 +903,8 @@ test_eventdev_link_get(void) ret = rte_event_port_unlink(TEST_DEV_ID, 0, NULL, 0); TEST_ASSERT(ret == nb_queues, "Failed to unlink(device%d) ret=%d", TEST_DEV_ID, ret); + /* 4links and 2 unlinks */ - nb_queues = rte_event_queue_count(TEST_DEV_ID); if (nb_queues >= 4) { for (i = 0; i < 4; i++) { queues[i] = i; @@ -741,15 +965,23 @@ static struct unit_test_suite eventdev_common_testsuite = { TEST_CASE_ST(eventdev_configure_setup, NULL, test_eventdev_queue_count), TEST_CASE_ST(eventdev_configure_setup, NULL, - test_eventdev_queue_priority), + test_eventdev_queue_attr_priority), + TEST_CASE_ST(eventdev_configure_setup, NULL, + test_eventdev_queue_attr_nb_atomic_flows), + TEST_CASE_ST(eventdev_configure_setup, NULL, + test_eventdev_queue_attr_nb_atomic_order_sequences), + TEST_CASE_ST(eventdev_configure_setup, NULL, + test_eventdev_queue_attr_event_queue_cfg), TEST_CASE_ST(eventdev_configure_setup, NULL, test_eventdev_port_default_conf_get), TEST_CASE_ST(eventdev_configure_setup, NULL, test_eventdev_port_setup), TEST_CASE_ST(eventdev_configure_setup, NULL, - test_eventdev_dequeue_depth), + test_eventdev_port_attr_dequeue_depth), + TEST_CASE_ST(eventdev_configure_setup, NULL, + test_eventdev_port_attr_enqueue_depth), TEST_CASE_ST(eventdev_configure_setup, NULL, - test_eventdev_enqueue_depth), + test_eventdev_port_attr_new_event_threshold), TEST_CASE_ST(eventdev_configure_setup, NULL, test_eventdev_port_count), TEST_CASE_ST(eventdev_configure_setup, NULL, diff --git a/test/test/test_eventdev_octeontx.c b/test/test/test_eventdev_octeontx.c index 774d0303..dbc36d94 100644 --- a/test/test/test_eventdev_octeontx.c +++ b/test/test/test_eventdev_octeontx.c @@ -45,6 +45,7 @@ #include <rte_lcore.h> #include <rte_per_lcore.h> #include <rte_random.h> +#include <rte_bus_vdev.h> #include "test.h" @@ -193,8 +194,13 @@ _eventdev_setup(int mode) ret = rte_event_dev_configure(evdev, &dev_conf); TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev"); + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, + &queue_count), "Queue count get failed"); + if (mode == TEST_EVENTDEV_SETUP_PRIORITY) { - if (rte_event_queue_count(evdev) > 8) { + if (queue_count > 8) { printf("test expects the unique priority per queue\n"); return -ENOTSUP; } @@ -204,8 +210,8 @@ _eventdev_setup(int mode) * RTE_EVENT_DEV_PRIORITY_LOWEST */ uint8_t step = (RTE_EVENT_DEV_PRIORITY_LOWEST + 1) / - rte_event_queue_count(evdev); - for (i = 0; i < rte_event_queue_count(evdev); i++) { + queue_count; + for (i = 0; i < (int)queue_count; i++) { struct rte_event_queue_conf queue_conf; ret = rte_event_queue_default_conf_get(evdev, i, @@ -218,13 +224,17 @@ _eventdev_setup(int mode) } else { /* Configure event queues with default priority */ - for (i = 0; i < rte_event_queue_count(evdev); i++) { + for (i = 0; i < (int)queue_count; i++) { ret = rte_event_queue_setup(evdev, i, NULL); TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d", i); } } /* Configure event ports */ - for (i = 0; i < rte_event_port_count(evdev); i++) { + uint32_t port_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &port_count), "Port count get failed"); + for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_setup(evdev, i, NULL); TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d", i); ret = rte_event_port_link(evdev, i, NULL, NULL, 0); @@ -335,6 +345,11 @@ generate_random_events(const unsigned int total_events) unsigned int i; int ret; + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, + &queue_count), "Queue count get failed"); + ret = rte_event_dev_info_get(evdev, &info); TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); for (i = 0; i < total_events; i++) { @@ -343,7 +358,7 @@ generate_random_events(const unsigned int total_events) rte_rand() % (RTE_EVENT_TYPE_CPU + 1) /* event_type */, rte_rand() % 256 /* sub_event_type */, rte_rand() % (RTE_SCHED_TYPE_PARALLEL + 1), - rte_rand() % rte_event_queue_count(evdev) /* queue */, + rte_rand() % queue_count /* queue */, 0 /* port */, 1 /* events */); if (ret) @@ -482,7 +497,7 @@ test_multi_queue_enq_single_port_deq(void) } /* - * Inject 0..MAX_EVENTS events over 0..rte_event_queue_count() with modulus + * Inject 0..MAX_EVENTS events over 0..queue_count with modulus * operation * * For example, Inject 32 events over 0..7 queues @@ -498,15 +513,19 @@ test_multi_queue_enq_single_port_deq(void) static int validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) { - uint32_t range = MAX_EVENTS / rte_event_queue_count(evdev); - uint32_t expected_val = (index % range) * rte_event_queue_count(evdev); + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, + &queue_count), "Queue count get failed"); + uint32_t range = MAX_EVENTS / queue_count; + uint32_t expected_val = (index % range) * queue_count; expected_val += ev->queue_id; RTE_SET_USED(port); TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d", ev->mbuf->seqn, index, expected_val, range, - rte_event_queue_count(evdev), MAX_EVENTS); + queue_count, MAX_EVENTS); return 0; } @@ -518,8 +537,12 @@ test_multi_queue_priority(void) int i, max_evts_roundoff; /* See validate_queue_priority() comments for priority validate logic */ - max_evts_roundoff = MAX_EVENTS / rte_event_queue_count(evdev); - max_evts_roundoff *= rte_event_queue_count(evdev); + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, + &queue_count), "Queue count get failed"); + max_evts_roundoff = MAX_EVENTS / queue_count; + max_evts_roundoff *= queue_count; for (i = 0; i < max_evts_roundoff; i++) { struct rte_event ev = {.event = 0, .u64 = 0}; @@ -528,7 +551,7 @@ test_multi_queue_priority(void) TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); m->seqn = i; - queue = i % rte_event_queue_count(evdev); + queue = i % queue_count; update_event_and_validation_attr(m, &ev, 0, RTE_EVENT_TYPE_CPU, 0, RTE_SCHED_TYPE_PARALLEL, queue, 0); rte_event_enqueue_burst(evdev, 0, &ev, 1); @@ -651,18 +674,21 @@ static int test_multi_queue_enq_multi_port_deq(void) { const unsigned int total_events = MAX_EVENTS; - uint8_t nr_ports; + uint32_t nr_ports; int ret; ret = generate_random_events(total_events); if (ret) return TEST_FAILED; - nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1); + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &nr_ports), "Port count get failed"); + nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { printf("%s: Not enough ports=%d or workers=%d\n", __func__, - rte_event_port_count(evdev), rte_lcore_count() - 1); + nr_ports, rte_lcore_count() - 1); return TEST_SUCCESS; } @@ -691,14 +717,23 @@ test_queue_to_port_single_link(void) { int i, nr_links, ret; + uint32_t port_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &port_count), "Port count get failed"); + /* Unlink all connections that created in eventdev_setup */ - for (i = 0; i < rte_event_port_count(evdev); i++) { + for (i = 0; i < (int)port_count; i++) { ret = rte_event_port_unlink(evdev, i, NULL, 0); TEST_ASSERT(ret >= 0, "Failed to unlink all queues port=%d", i); } - nr_links = RTE_MIN(rte_event_port_count(evdev), - rte_event_queue_count(evdev)); + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, + &queue_count), "Queue count get failed"); + + nr_links = RTE_MIN(port_count, queue_count); const unsigned int total_events = MAX_EVENTS / nr_links; /* Link queue x to port x and inject events to queue x through port x */ @@ -750,10 +785,20 @@ static int test_queue_to_port_multi_link(void) { int ret, port0_events = 0, port1_events = 0; - uint8_t nr_queues, nr_ports, queue, port; + uint8_t queue, port; + uint32_t nr_queues = 0; + uint32_t nr_ports = 0; + + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, + &nr_queues), "Queue count get failed"); - nr_queues = rte_event_queue_count(evdev); - nr_ports = rte_event_port_count(evdev); + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, + &nr_queues), "Queue count get failed"); + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &nr_ports), "Port count get failed"); if (nr_ports < 2) { printf("%s: Not enough ports to test ports=%d\n", @@ -854,14 +899,17 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, uint8_t out_sched_type) { const unsigned int total_events = MAX_EVENTS; - uint8_t nr_ports; + uint32_t nr_ports; int ret; - nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1); + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &nr_ports), "Port count get failed"); + nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { printf("%s: Not enough ports=%d or workers=%d\n", __func__, - rte_event_port_count(evdev), rte_lcore_count() - 1); + nr_ports, rte_lcore_count() - 1); return TEST_SUCCESS; } @@ -1007,15 +1055,23 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, uint8_t out_sched_type) { const unsigned int total_events = MAX_EVENTS; - uint8_t nr_ports; + uint32_t nr_ports; int ret; - nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1); + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &nr_ports), "Port count get failed"); + + nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); - if (rte_event_queue_count(evdev) < 2 || !nr_ports) { + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, + &queue_count), "Queue count get failed"); + if (queue_count < 2 || !nr_ports) { printf("%s: Not enough queues=%d ports=%d or workers=%d\n", - __func__, rte_event_queue_count(evdev), - rte_event_port_count(evdev), rte_lcore_count() - 1); + __func__, queue_count, nr_ports, + rte_lcore_count() - 1); return TEST_SUCCESS; } @@ -1142,14 +1198,17 @@ worker_flow_based_pipeline_max_stages_rand_sched_type(void *arg) static int launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) { - uint8_t nr_ports; + uint32_t nr_ports; int ret; - nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1); + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &nr_ports), "Port count get failed"); + nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (!nr_ports) { printf("%s: Not enough ports=%d or workers=%d\n", __func__, - rte_event_port_count(evdev), rte_lcore_count() - 1); + nr_ports, rte_lcore_count() - 1); return TEST_SUCCESS; } @@ -1184,7 +1243,11 @@ worker_queue_based_pipeline_max_stages_rand_sched_type(void *arg) struct rte_event ev; uint16_t valid_event; uint8_t port = param->port; - uint8_t nr_queues = rte_event_queue_count(evdev); + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, + &queue_count), "Queue count get failed"); + uint8_t nr_queues = queue_count; rte_atomic32_t *total_events = param->total_events; while (rte_atomic32_read(total_events) > 0) { @@ -1222,7 +1285,11 @@ worker_mixed_pipeline_max_stages_rand_sched_type(void *arg) struct rte_event ev; uint16_t valid_event; uint8_t port = param->port; - uint8_t nr_queues = rte_event_queue_count(evdev); + uint32_t queue_count; + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_QUEUE_COUNT, + &queue_count), "Queue count get failed"); + uint8_t nr_queues = queue_count; rte_atomic32_t *total_events = param->total_events; while (rte_atomic32_read(total_events) > 0) { @@ -1288,9 +1355,12 @@ worker_ordered_flow_producer(void *arg) static inline int test_producer_consumer_ingress_order_test(int (*fn)(void *)) { - uint8_t nr_ports; + uint32_t nr_ports; - nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1); + TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(evdev, + RTE_EVENT_DEV_ATTR_PORT_COUNT, + &nr_ports), "Port count get failed"); + nr_ports = RTE_MIN(nr_ports, rte_lcore_count() - 1); if (rte_lcore_count() < 3 || nr_ports < 2) { printf("### Not enough cores for %s test.\n", __func__); diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c index ba8c053e..f524b6f8 100644 --- a/test/test/test_eventdev_sw.c +++ b/test/test/test_eventdev_sw.c @@ -39,7 +39,6 @@ #include <sys/queue.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> @@ -49,6 +48,9 @@ #include <rte_cycles.h> #include <rte_eventdev.h> #include <rte_pause.h> +#include <rte_service.h> +#include <rte_service_component.h> +#include <rte_bus_vdev.h> #include "test.h" @@ -63,6 +65,7 @@ struct test { uint8_t port[MAX_PORTS]; uint8_t qid[MAX_QIDS]; int nb_qids; + uint32_t service_id; }; static struct rte_event release_ev; @@ -219,7 +222,7 @@ create_lb_qids(struct test *t, int num_qids, uint32_t flags) /* Q creation */ const struct rte_event_queue_conf conf = { - .event_queue_cfg = flags, + .schedule_type = flags, .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, .nb_atomic_flows = 1024, .nb_atomic_order_sequences = 1024, @@ -242,20 +245,20 @@ create_lb_qids(struct test *t, int num_qids, uint32_t flags) static inline int create_atomic_qids(struct test *t, int num_qids) { - return create_lb_qids(t, num_qids, RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY); + return create_lb_qids(t, num_qids, RTE_SCHED_TYPE_ATOMIC); } static inline int create_ordered_qids(struct test *t, int num_qids) { - return create_lb_qids(t, num_qids, RTE_EVENT_QUEUE_CFG_ORDERED_ONLY); + return create_lb_qids(t, num_qids, RTE_SCHED_TYPE_ORDERED); } static inline int create_unordered_qids(struct test *t, int num_qids) { - return create_lb_qids(t, num_qids, RTE_EVENT_QUEUE_CFG_PARALLEL_ONLY); + return create_lb_qids(t, num_qids, RTE_SCHED_TYPE_PARALLEL); } static inline int @@ -267,8 +270,6 @@ create_directed_qids(struct test *t, int num_qids, const uint8_t ports[]) static const struct rte_event_queue_conf conf = { .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, .event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK, - .nb_atomic_flows = 1024, - .nb_atomic_order_sequences = 1024, }; for (i = t->nb_qids; i < t->nb_qids + num_qids; i++) { @@ -417,7 +418,7 @@ run_prio_packet_test(struct test *t) } } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); struct test_event_dev_stats stats; err = test_event_dev_stats_get(evdev, &stats); @@ -509,7 +510,7 @@ test_single_directed_packet(struct test *t) } /* Run schedule() as dir packets may need to be re-ordered */ - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); struct test_event_dev_stats stats; err = test_event_dev_stats_get(evdev, &stats); @@ -576,7 +577,7 @@ test_directed_forward_credits(struct test *t) printf("%d: error failed to enqueue\n", __LINE__); return -1; } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); uint32_t deq_pkts; deq_pkts = rte_event_dequeue_burst(evdev, 0, &ev, 1, 0); @@ -738,7 +739,7 @@ burst_packets(struct test *t) return -1; } } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); /* Check stats for all NUM_PKTS arrived to sched core */ struct test_event_dev_stats stats; @@ -827,7 +828,7 @@ abuse_inflights(struct test *t) } /* schedule */ - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); struct test_event_dev_stats stats; @@ -965,7 +966,7 @@ xstats_tests(struct test *t) } } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); /* Device names / values */ int num_stats = rte_event_dev_xstats_names_get(evdev, @@ -1240,7 +1241,7 @@ port_reconfig_credits(struct test *t) const uint32_t NUM_ITERS = 32; for (i = 0; i < NUM_ITERS; i++) { const struct rte_event_queue_conf conf = { - .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY, + .schedule_type = RTE_SCHED_TYPE_ATOMIC, .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, .nb_atomic_flows = 1024, .nb_atomic_order_sequences = 1024, @@ -1292,7 +1293,7 @@ port_reconfig_credits(struct test *t) } } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); struct rte_event ev[NPKTS]; int deq = rte_event_dequeue_burst(evdev, t->port[0], ev, @@ -1322,7 +1323,7 @@ port_single_lb_reconfig(struct test *t) static const struct rte_event_queue_conf conf_lb_atomic = { .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, - .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY, + .schedule_type = RTE_SCHED_TYPE_ATOMIC, .nb_atomic_flows = 1024, .nb_atomic_order_sequences = 1024, }; @@ -1334,8 +1335,6 @@ port_single_lb_reconfig(struct test *t) static const struct rte_event_queue_conf conf_single_link = { .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, .event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK, - .nb_atomic_flows = 1024, - .nb_atomic_order_sequences = 1024, }; if (rte_event_queue_setup(evdev, 1, &conf_single_link) < 0) { printf("%d: error creating qid\n", __LINE__); @@ -1520,7 +1519,7 @@ xstats_id_reset_tests(struct test *t) } } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); static const char * const dev_names[] = { "dev_rx", "dev_tx", "dev_drop", "dev_sched_calls", @@ -1822,7 +1821,7 @@ ordered_reconfigure(struct test *t) } const struct rte_event_queue_conf conf = { - .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ORDERED_ONLY, + .schedule_type = RTE_SCHED_TYPE_ORDERED, .priority = RTE_EVENT_DEV_PRIORITY_NORMAL, .nb_atomic_flows = 1024, .nb_atomic_order_sequences = 1024, @@ -1869,7 +1868,7 @@ qid_priorities(struct test *t) for (i = 0; i < 3; i++) { /* Create QID */ const struct rte_event_queue_conf conf = { - .event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY, + .schedule_type = RTE_SCHED_TYPE_ATOMIC, /* increase priority (0 == highest), as we go */ .priority = RTE_EVENT_DEV_PRIORITY_NORMAL - i, .nb_atomic_flows = 1024, @@ -1911,7 +1910,7 @@ qid_priorities(struct test *t) } } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); /* dequeue packets, verify priority was upheld */ struct rte_event ev[32]; @@ -1992,7 +1991,7 @@ load_balancing(struct test *t) } } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); struct test_event_dev_stats stats; err = test_event_dev_stats_get(evdev, &stats); @@ -2092,7 +2091,7 @@ load_balancing_history(struct test *t) } /* call the scheduler */ - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); /* Dequeue the flow 0 packet from port 1, so that we can then drop */ struct rte_event ev; @@ -2109,7 +2108,7 @@ load_balancing_history(struct test *t) rte_event_enqueue_burst(evdev, t->port[1], &release_ev, 1); /* call the scheduler */ - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); /* * Set up the next set of flows, first a new flow to fill up @@ -2142,7 +2141,7 @@ load_balancing_history(struct test *t) } /* schedule */ - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); err = test_event_dev_stats_get(evdev, &stats); if (err) { @@ -2186,7 +2185,7 @@ load_balancing_history(struct test *t) while (rte_event_dequeue_burst(evdev, i, &ev, 1, 0)) rte_event_enqueue_burst(evdev, i, &release_ev, 1); } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); cleanup(t); return 0; @@ -2252,7 +2251,7 @@ invalid_qid(struct test *t) } /* call the scheduler */ - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); err = test_event_dev_stats_get(evdev, &stats); if (err) { @@ -2337,7 +2336,7 @@ single_packet(struct test *t) return -1; } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); err = test_event_dev_stats_get(evdev, &stats); if (err) { @@ -2380,7 +2379,7 @@ single_packet(struct test *t) printf("%d: Failed to enqueue\n", __LINE__); return -1; } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); err = test_event_dev_stats_get(evdev, &stats); if (stats.port_inflight[wrk_enq] != 0) { @@ -2468,7 +2467,7 @@ inflight_counts(struct test *t) } /* schedule */ - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); err = test_event_dev_stats_get(evdev, &stats); if (err) { @@ -2524,7 +2523,7 @@ inflight_counts(struct test *t) * As the scheduler core decrements inflights, it needs to run to * process packets to act on the drop messages */ - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); err = test_event_dev_stats_get(evdev, &stats); if (stats.port_inflight[p1] != 0) { @@ -2559,7 +2558,7 @@ inflight_counts(struct test *t) * As the scheduler core decrements inflights, it needs to run to * process packets to act on the drop messages */ - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); err = test_event_dev_stats_get(evdev, &stats); if (stats.port_inflight[p2] != 0) { @@ -2653,7 +2652,7 @@ parallel_basic(struct test *t, int check_order) } } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); /* use extra slot to make logic in loops easier */ struct rte_event deq_ev[w3_port + 1]; @@ -2680,7 +2679,7 @@ parallel_basic(struct test *t, int check_order) return -1; } } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); /* dequeue from the tx ports, we should get 3 packets */ deq_pkts = rte_event_dequeue_burst(evdev, t->port[tx_port], deq_ev, @@ -2758,7 +2757,7 @@ holb(struct test *t) /* test to check we avoid basic head-of-line blocking */ printf("%d: Error doing first enqueue\n", __LINE__); goto err; } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); if (rte_event_dev_xstats_by_name_get(evdev, "port_0_cq_ring_used", NULL) != 1) @@ -2783,7 +2782,7 @@ holb(struct test *t) /* test to check we avoid basic head-of-line blocking */ printf("%d: Error with enqueue\n", __LINE__); goto err; } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); } while (rte_event_dev_xstats_by_name_get(evdev, rx_port_free_stat, NULL) != 0); @@ -2793,7 +2792,7 @@ holb(struct test *t) /* test to check we avoid basic head-of-line blocking */ printf("%d: Error with enqueue\n", __LINE__); goto err; } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); /* check that the other port still has an empty CQ */ if (rte_event_dev_xstats_by_name_get(evdev, other_port_used_stat, NULL) @@ -2816,7 +2815,7 @@ holb(struct test *t) /* test to check we avoid basic head-of-line blocking */ printf("%d: Error with enqueue\n", __LINE__); goto err; } - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); if (rte_event_dev_xstats_by_name_get(evdev, other_port_used_stat, NULL) != 1) { @@ -3006,7 +3005,7 @@ worker_loopback(struct test *t) while (rte_eal_get_lcore_state(p_lcore) != FINISHED || rte_eal_get_lcore_state(w_lcore) != FINISHED) { - rte_event_schedule(evdev); + rte_service_run_iter_on_app_lcore(t->service_id, 1); uint64_t new_cycles = rte_get_timer_cycles(); @@ -3033,7 +3032,8 @@ worker_loopback(struct test *t) cycles = new_cycles; } } - rte_event_schedule(evdev); /* ensure all completions are flushed */ + rte_service_run_iter_on_app_lcore(t->service_id, 1); + /* ensure all completions are flushed */ rte_eal_mp_wait_lcore(); @@ -3070,6 +3070,14 @@ test_sw_eventdev(void) } } + if (rte_event_dev_service_id_get(evdev, &t->service_id) < 0) { + printf("Failed to get service ID for software event dev\n"); + return -1; + } + + rte_service_runstate_set(t->service_id, 1); + rte_service_set_runstate_mapped_check(t->service_id, 0); + /* Only create mbuf pool once, reuse for each test run */ if (!eventdev_func_mempool) { eventdev_func_mempool = rte_pktmbuf_pool_create( diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c new file mode 100644 index 00000000..9f331cd8 --- /dev/null +++ b/test/test/test_flow_classify.c @@ -0,0 +1,672 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2017 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <string.h> +#include <errno.h> + +#include "test.h" + +#include <rte_string_fns.h> +#include <rte_mbuf.h> +#include <rte_byteorder.h> +#include <rte_ip.h> +#include <rte_acl.h> +#include <rte_common.h> +#include <rte_table_acl.h> +#include <rte_flow.h> +#include <rte_flow_classify.h> + +#include "packet_burst_generator.h" +#include "test_flow_classify.h" + + +#define FLOW_CLASSIFY_MAX_RULE_NUM 100 +struct flow_classifier *cls; + +struct flow_classifier { + struct rte_flow_classifier *cls; + uint32_t table_id[RTE_FLOW_CLASSIFY_TABLE_MAX]; + uint32_t n_tables; +}; + +struct flow_classifier_acl { + struct flow_classifier cls; +} __rte_cache_aligned; + +/* + * test functions by passing invalid or + * non-workable parameters. + */ +static int +test_invalid_parameters(void) +{ + struct rte_flow_classify_rule *rule; + int ret; + + rule = rte_flow_classify_table_entry_add(NULL, 1, NULL, NULL, NULL, + NULL, NULL); + if (rule) { + printf("Line %i: flow_classifier_table_entry_add", __LINE__); + printf(" with NULL param should have failed!\n"); + return -1; + } + + ret = rte_flow_classify_table_entry_delete(NULL, 1, NULL); + if (!ret) { + printf("Line %i: rte_flow_classify_table_entry_delete", + __LINE__); + printf(" with NULL param should have failed!\n"); + return -1; + } + + ret = rte_flow_classifier_query(NULL, 1, NULL, 0, NULL, NULL); + if (!ret) { + printf("Line %i: flow_classifier_query", __LINE__); + printf(" with NULL param should have failed!\n"); + return -1; + } + + rule = rte_flow_classify_table_entry_add(NULL, 1, NULL, NULL, NULL, + NULL, &error); + if (rule) { + printf("Line %i: flow_classify_table_entry_add ", __LINE__); + printf("with NULL param should have failed!\n"); + return -1; + } + + ret = rte_flow_classify_table_entry_delete(NULL, 1, NULL); + if (!ret) { + printf("Line %i: rte_flow_classify_table_entry_delete", + __LINE__); + printf("with NULL param should have failed!\n"); + return -1; + } + + ret = rte_flow_classifier_query(NULL, 1, NULL, 0, NULL, NULL); + if (!ret) { + printf("Line %i: flow_classifier_query", __LINE__); + printf(" with NULL param should have failed!\n"); + return -1; + } + return 0; +} + +static int +test_valid_parameters(void) +{ + struct rte_flow_classify_rule *rule; + int ret; + int key_found; + + /* + * set up parameters for rte_flow_classify_table_entry_add and + * rte_flow_classify_table_entry_delete + */ + + attr.ingress = 1; + attr.priority = 1; + pattern[0] = eth_item; + pattern[1] = ipv4_udp_item_1; + pattern[2] = udp_item_1; + pattern[3] = end_item; + actions[0] = count_action; + actions[1] = end_action; + + rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, + &attr, pattern, actions, &error); + if (!rule) { + printf("Line %i: flow_classify_table_entry_add", __LINE__); + printf(" should not have failed!\n"); + return -1; + } + + ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + if (ret) { + printf("Line %i: rte_flow_classify_table_entry_delete", + __LINE__); + printf(" should not have failed!\n"); + return -1; + } + return 0; +} + +static int +test_invalid_patterns(void) +{ + struct rte_flow_classify_rule *rule; + int ret; + int key_found; + + /* + * set up parameters for rte_flow_classify_table_entry_add and + * rte_flow_classify_table_entry_delete + */ + + attr.ingress = 1; + attr.priority = 1; + pattern[0] = eth_item_bad; + pattern[1] = ipv4_udp_item_1; + pattern[2] = udp_item_1; + pattern[3] = end_item; + actions[0] = count_action; + actions[1] = end_action; + + pattern[0] = eth_item; + pattern[1] = ipv4_udp_item_bad; + rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, + &attr, pattern, actions, &error); + if (rule) { + printf("Line %i: flow_classify_table_entry_add", __LINE__); + printf(" should have failed!\n"); + return -1; + } + + ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + if (!ret) { + printf("Line %i: rte_flow_classify_table_entry_delete", + __LINE__); + printf(" should have failed!\n"); + return -1; + } + + pattern[1] = ipv4_udp_item_1; + pattern[2] = udp_item_bad; + pattern[3] = end_item_bad; + rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, + &attr, pattern, actions, &error); + if (rule) { + printf("Line %i: flow_classify_table_entry_add", __LINE__); + printf(" should have failed!\n"); + return -1; + } + + ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + if (!ret) { + printf("Line %i: rte_flow_classify_table_entry_delete", + __LINE__); + printf(" should have failed!\n"); + return -1; + } + return 0; +} + +static int +test_invalid_actions(void) +{ + struct rte_flow_classify_rule *rule; + int ret; + int key_found; + + /* + * set up parameters for rte_flow_classify_table_entry_add and + * rte_flow_classify_table_entry_delete + */ + + attr.ingress = 1; + attr.priority = 1; + pattern[0] = eth_item; + pattern[1] = ipv4_udp_item_1; + pattern[2] = udp_item_1; + pattern[3] = end_item; + actions[0] = count_action_bad; + actions[1] = end_action; + + rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, + &attr, pattern, actions, &error); + if (rule) { + printf("Line %i: flow_classify_table_entry_add", __LINE__); + printf(" should have failed!\n"); + return -1; + } + + ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + if (!ret) { + printf("Line %i: rte_flow_classify_table_entry_delete", + __LINE__); + printf(" should have failed!\n"); + return -1; + } + + actions[0] = count_action; + actions[1] = end_action_bad; + + rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, + &attr, pattern, actions, &error); + if (rule) { + printf("Line %i: flow_classify_table_entry_add", __LINE__); + printf(" should have failed!\n"); + return -1; + } + + ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + if (!ret) { + printf("Line %i: rte_flow_classify_table_entry_delete", + __LINE__); + printf("should have failed!\n"); + return -1; + } + return 0; +} + +static int +init_ipv4_udp_traffic(struct rte_mempool *mp, + struct rte_mbuf **pkts_burst, uint32_t burst_size) +{ + struct ether_hdr pkt_eth_hdr; + struct ipv4_hdr pkt_ipv4_hdr; + struct udp_hdr pkt_udp_hdr; + uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); + uint32_t dst_addr = IPV4_ADDR(2, 2, 2, 7); + uint16_t src_port = 32; + uint16_t dst_port = 33; + uint16_t pktlen; + + static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; + static uint8_t dst_mac[] = { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA }; + + printf("Set up IPv4 UDP traffic\n"); + initialize_eth_header(&pkt_eth_hdr, + (struct ether_addr *)src_mac, + (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct ether_hdr)); + printf("ETH pktlen %u\n", pktlen); + + pktlen = initialize_ipv4_header(&pkt_ipv4_hdr, src_addr, dst_addr, + pktlen); + printf("ETH + IPv4 pktlen %u\n", pktlen); + + pktlen = initialize_udp_header(&pkt_udp_hdr, src_port, dst_port, + pktlen); + printf("ETH + IPv4 + UDP pktlen %u\n\n", pktlen); + + return generate_packet_burst(mp, pkts_burst, &pkt_eth_hdr, + 0, &pkt_ipv4_hdr, 1, + &pkt_udp_hdr, burst_size, + PACKET_BURST_GEN_PKT_LEN, 1); +} + +static int +init_ipv4_tcp_traffic(struct rte_mempool *mp, + struct rte_mbuf **pkts_burst, uint32_t burst_size) +{ + struct ether_hdr pkt_eth_hdr; + struct ipv4_hdr pkt_ipv4_hdr; + struct tcp_hdr pkt_tcp_hdr; + uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); + uint32_t dst_addr = IPV4_ADDR(5, 6, 7, 8); + uint16_t src_port = 16; + uint16_t dst_port = 17; + uint16_t pktlen; + + static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; + static uint8_t dst_mac[] = { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA }; + + printf("Set up IPv4 TCP traffic\n"); + initialize_eth_header(&pkt_eth_hdr, + (struct ether_addr *)src_mac, + (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct ether_hdr)); + printf("ETH pktlen %u\n", pktlen); + + pktlen = initialize_ipv4_header_proto(&pkt_ipv4_hdr, src_addr, + dst_addr, pktlen, IPPROTO_TCP); + printf("ETH + IPv4 pktlen %u\n", pktlen); + + pktlen = initialize_tcp_header(&pkt_tcp_hdr, src_port, dst_port, + pktlen); + printf("ETH + IPv4 + TCP pktlen %u\n\n", pktlen); + + return generate_packet_burst_proto(mp, pkts_burst, &pkt_eth_hdr, + 0, &pkt_ipv4_hdr, 1, IPPROTO_TCP, + &pkt_tcp_hdr, burst_size, + PACKET_BURST_GEN_PKT_LEN, 1); +} + +static int +init_ipv4_sctp_traffic(struct rte_mempool *mp, + struct rte_mbuf **pkts_burst, uint32_t burst_size) +{ + struct ether_hdr pkt_eth_hdr; + struct ipv4_hdr pkt_ipv4_hdr; + struct sctp_hdr pkt_sctp_hdr; + uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); + uint32_t dst_addr = IPV4_ADDR(15, 16, 17, 18); + uint16_t src_port = 10; + uint16_t dst_port = 11; + uint16_t pktlen; + + static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; + static uint8_t dst_mac[] = { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA }; + + printf("Set up IPv4 SCTP traffic\n"); + initialize_eth_header(&pkt_eth_hdr, + (struct ether_addr *)src_mac, + (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct ether_hdr)); + printf("ETH pktlen %u\n", pktlen); + + pktlen = initialize_ipv4_header_proto(&pkt_ipv4_hdr, src_addr, + dst_addr, pktlen, IPPROTO_SCTP); + printf("ETH + IPv4 pktlen %u\n", pktlen); + + pktlen = initialize_sctp_header(&pkt_sctp_hdr, src_port, dst_port, + pktlen); + printf("ETH + IPv4 + SCTP pktlen %u\n\n", pktlen); + + return generate_packet_burst_proto(mp, pkts_burst, &pkt_eth_hdr, + 0, &pkt_ipv4_hdr, 1, IPPROTO_SCTP, + &pkt_sctp_hdr, burst_size, + PACKET_BURST_GEN_PKT_LEN, 1); +} + +static int +init_mbufpool(void) +{ + int socketid; + int ret = 0; + unsigned int lcore_id; + char s[64]; + + for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { + if (rte_lcore_is_enabled(lcore_id) == 0) + continue; + + socketid = rte_lcore_to_socket_id(lcore_id); + if (socketid >= NB_SOCKETS) { + printf( + "Socket %d of lcore %u is out of range %d\n", + socketid, lcore_id, NB_SOCKETS); + ret = -1; + break; + } + if (mbufpool[socketid] == NULL) { + snprintf(s, sizeof(s), "mbuf_pool_%d", socketid); + mbufpool[socketid] = + rte_pktmbuf_pool_create(s, NB_MBUF, + MEMPOOL_CACHE_SIZE, 0, MBUF_SIZE, + socketid); + if (mbufpool[socketid]) { + printf("Allocated mbuf pool on socket %d\n", + socketid); + } else { + printf("Cannot init mbuf pool on socket %d\n", + socketid); + ret = -ENOMEM; + break; + } + } + } + return ret; +} + +static int +test_query_udp(void) +{ + struct rte_flow_error error; + struct rte_flow_classify_rule *rule; + int ret; + int i; + int key_found; + + ret = init_ipv4_udp_traffic(mbufpool[0], bufs, MAX_PKT_BURST); + if (ret != MAX_PKT_BURST) { + printf("Line %i: init_udp_ipv4_traffic has failed!\n", + __LINE__); + return -1; + } + + for (i = 0; i < MAX_PKT_BURST; i++) + bufs[i]->packet_type = RTE_PTYPE_L3_IPV4; + + /* + * set up parameters for rte_flow_classify_table_entry_add and + * rte_flow_classify_table_entry_delete + */ + + attr.ingress = 1; + attr.priority = 1; + pattern[0] = eth_item; + pattern[1] = ipv4_udp_item_1; + pattern[2] = udp_item_1; + pattern[3] = end_item; + actions[0] = count_action; + actions[1] = end_action; + + rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, + &attr, pattern, actions, &error); + if (!rule) { + printf("Line %i: flow_classify_table_entry_add", __LINE__); + printf(" should not have failed!\n"); + return -1; + } + + ret = rte_flow_classifier_query(cls->cls, 0, bufs, MAX_PKT_BURST, + rule, &udp_classify_stats); + if (ret) { + printf("Line %i: flow_classifier_query", __LINE__); + printf(" should not have failed!\n"); + return -1; + } + + ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + if (ret) { + printf("Line %i: rte_flow_classify_table_entry_delete", + __LINE__); + printf(" should not have failed!\n"); + return -1; + } + return 0; +} + +static int +test_query_tcp(void) +{ + struct rte_flow_classify_rule *rule; + int ret; + int i; + int key_found; + + ret = init_ipv4_tcp_traffic(mbufpool[0], bufs, MAX_PKT_BURST); + if (ret != MAX_PKT_BURST) { + printf("Line %i: init_ipv4_tcp_traffic has failed!\n", + __LINE__); + return -1; + } + + for (i = 0; i < MAX_PKT_BURST; i++) + bufs[i]->packet_type = RTE_PTYPE_L3_IPV4; + + /* + * set up parameters for rte_flow_classify_table_entry_add and + * rte_flow_classify_table_entry_delete + */ + + attr.ingress = 1; + attr.priority = 1; + pattern[0] = eth_item; + pattern[1] = ipv4_tcp_item_1; + pattern[2] = tcp_item_1; + pattern[3] = end_item; + actions[0] = count_action; + actions[1] = end_action; + + rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, + &attr, pattern, actions, &error); + if (!rule) { + printf("Line %i: flow_classify_table_entry_add", __LINE__); + printf(" should not have failed!\n"); + return -1; + } + + ret = rte_flow_classifier_query(cls->cls, 0, bufs, MAX_PKT_BURST, + rule, &tcp_classify_stats); + if (ret) { + printf("Line %i: flow_classifier_query", __LINE__); + printf(" should not have failed!\n"); + return -1; + } + + ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + if (ret) { + printf("Line %i: rte_flow_classify_table_entry_delete", + __LINE__); + printf(" should not have failed!\n"); + return -1; + } + return 0; +} + +static int +test_query_sctp(void) +{ + struct rte_flow_classify_rule *rule; + int ret; + int i; + int key_found; + + ret = init_ipv4_sctp_traffic(mbufpool[0], bufs, MAX_PKT_BURST); + if (ret != MAX_PKT_BURST) { + printf("Line %i: init_ipv4_tcp_traffic has failed!\n", + __LINE__); + return -1; + } + + for (i = 0; i < MAX_PKT_BURST; i++) + bufs[i]->packet_type = RTE_PTYPE_L3_IPV4; + + /* + * set up parameters rte_flow_classify_table_entry_add and + * rte_flow_classify_table_entry_delete + */ + + attr.ingress = 1; + attr.priority = 1; + pattern[0] = eth_item; + pattern[1] = ipv4_sctp_item_1; + pattern[2] = sctp_item_1; + pattern[3] = end_item; + actions[0] = count_action; + actions[1] = end_action; + + rule = rte_flow_classify_table_entry_add(cls->cls, 0, &key_found, + &attr, pattern, actions, &error); + if (!rule) { + printf("Line %i: flow_classify_table_entry_add", __LINE__); + printf(" should not have failed!\n"); + return -1; + } + + ret = rte_flow_classifier_query(cls->cls, 0, bufs, MAX_PKT_BURST, + rule, &sctp_classify_stats); + if (ret) { + printf("Line %i: flow_classifier_query", __LINE__); + printf(" should not have failed!\n"); + return -1; + } + + ret = rte_flow_classify_table_entry_delete(cls->cls, 0, rule); + if (ret) { + printf("Line %i: rte_flow_classify_table_entry_delete", + __LINE__); + printf(" should not have failed!\n"); + return -1; + } + return 0; +} + +static int +test_flow_classify(void) +{ + struct rte_table_acl_params table_acl_params; + struct rte_flow_classify_table_params cls_table_params; + struct rte_flow_classifier_params cls_params; + int socket_id; + int ret; + uint32_t size; + + socket_id = rte_eth_dev_socket_id(0); + + /* Memory allocation */ + size = RTE_CACHE_LINE_ROUNDUP(sizeof(struct flow_classifier_acl)); + cls = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE); + + cls_params.name = "flow_classifier"; + cls_params.socket_id = socket_id; + cls_params.type = RTE_FLOW_CLASSIFY_TABLE_TYPE_ACL; + cls->cls = rte_flow_classifier_create(&cls_params); + + /* initialise ACL table params */ + table_acl_params.n_rule_fields = RTE_DIM(ipv4_defs); + table_acl_params.name = "table_acl_ipv4_5tuple"; + table_acl_params.n_rules = FLOW_CLASSIFY_MAX_RULE_NUM; + memcpy(table_acl_params.field_format, ipv4_defs, sizeof(ipv4_defs)); + + /* initialise table create params */ + cls_table_params.ops = &rte_table_acl_ops, + cls_table_params.arg_create = &table_acl_params, + + ret = rte_flow_classify_table_create(cls->cls, &cls_table_params, + &cls->table_id[0]); + if (ret) { + printf("Line %i: f_create has failed!\n", __LINE__); + rte_flow_classifier_free(cls->cls); + rte_free(cls); + return -1; + } + printf("Created table_acl for for IPv4 five tuple packets\n"); + + ret = init_mbufpool(); + if (ret) { + printf("Line %i: init_mbufpool has failed!\n", __LINE__); + return -1; + } + + if (test_invalid_parameters() < 0) + return -1; + if (test_valid_parameters() < 0) + return -1; + if (test_invalid_patterns() < 0) + return -1; + if (test_invalid_actions() < 0) + return -1; + if (test_query_udp() < 0) + return -1; + if (test_query_tcp() < 0) + return -1; + if (test_query_sctp() < 0) + return -1; + + return 0; +} + +REGISTER_TEST_COMMAND(flow_classify_autotest, test_flow_classify); diff --git a/test/test/test_flow_classify.h b/test/test/test_flow_classify.h new file mode 100644 index 00000000..39535cfc --- /dev/null +++ b/test/test/test_flow_classify.h @@ -0,0 +1,234 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2017 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TEST_FLOW_CLASSIFY_H_ +#define TEST_FLOW_CLASSIFY_H_ + +#define MAX_PKT_BURST (32) +#define NB_SOCKETS (1) +#define MEMPOOL_CACHE_SIZE (256) +#define MBUF_SIZE (512) +#define NB_MBUF (512) + +/* test UDP, TCP and SCTP packets */ +static struct rte_mempool *mbufpool[NB_SOCKETS]; +static struct rte_mbuf *bufs[MAX_PKT_BURST]; + +/* ACL field definitions for IPv4 5 tuple rule */ + +enum { + PROTO_FIELD_IPV4, + SRC_FIELD_IPV4, + DST_FIELD_IPV4, + SRCP_FIELD_IPV4, + DSTP_FIELD_IPV4, + NUM_FIELDS_IPV4 +}; + +enum { + PROTO_INPUT_IPV4, + SRC_INPUT_IPV4, + DST_INPUT_IPV4, + SRCP_DESTP_INPUT_IPV4 +}; + +static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { + /* first input field - always one byte long. */ + { + .type = RTE_ACL_FIELD_TYPE_BITMASK, + .size = sizeof(uint8_t), + .field_index = PROTO_FIELD_IPV4, + .input_index = PROTO_INPUT_IPV4, + .offset = sizeof(struct ether_hdr) + + offsetof(struct ipv4_hdr, next_proto_id), + }, + /* next input field (IPv4 source address) - 4 consecutive bytes. */ + { + /* rte_flow uses a bit mask for IPv4 addresses */ + .type = RTE_ACL_FIELD_TYPE_BITMASK, + .size = sizeof(uint32_t), + .field_index = SRC_FIELD_IPV4, + .input_index = SRC_INPUT_IPV4, + .offset = sizeof(struct ether_hdr) + + offsetof(struct ipv4_hdr, src_addr), + }, + /* next input field (IPv4 destination address) - 4 consecutive bytes. */ + { + /* rte_flow uses a bit mask for IPv4 addresses */ + .type = RTE_ACL_FIELD_TYPE_BITMASK, + .size = sizeof(uint32_t), + .field_index = DST_FIELD_IPV4, + .input_index = DST_INPUT_IPV4, + .offset = sizeof(struct ether_hdr) + + offsetof(struct ipv4_hdr, dst_addr), + }, + /* + * Next 2 fields (src & dst ports) form 4 consecutive bytes. + * They share the same input index. + */ + { + /* rte_flow uses a bit mask for protocol ports */ + .type = RTE_ACL_FIELD_TYPE_BITMASK, + .size = sizeof(uint16_t), + .field_index = SRCP_FIELD_IPV4, + .input_index = SRCP_DESTP_INPUT_IPV4, + .offset = sizeof(struct ether_hdr) + + sizeof(struct ipv4_hdr) + + offsetof(struct tcp_hdr, src_port), + }, + { + /* rte_flow uses a bit mask for protocol ports */ + .type = RTE_ACL_FIELD_TYPE_BITMASK, + .size = sizeof(uint16_t), + .field_index = DSTP_FIELD_IPV4, + .input_index = SRCP_DESTP_INPUT_IPV4, + .offset = sizeof(struct ether_hdr) + + sizeof(struct ipv4_hdr) + + offsetof(struct tcp_hdr, dst_port), + }, +}; + +/* parameters for rte_flow_classify_validate and rte_flow_classify_create */ + +/* test UDP pattern: + * "eth / ipv4 src spec 2.2.2.3 src mask 255.255.255.00 dst spec 2.2.2.7 + * dst mask 255.255.255.00 / udp src is 32 dst is 33 / end" + */ +static struct rte_flow_item_ipv4 ipv4_udp_spec_1 = { + { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, IPv4(2, 2, 2, 3), IPv4(2, 2, 2, 7)} +}; +static const struct rte_flow_item_ipv4 ipv4_mask_24 = { + .hdr = { + .next_proto_id = 0xff, + .src_addr = 0xffffff00, + .dst_addr = 0xffffff00, + }, +}; +static struct rte_flow_item_udp udp_spec_1 = { + { 32, 33, 0, 0 } +}; + +static struct rte_flow_item eth_item = { RTE_FLOW_ITEM_TYPE_ETH, + 0, 0, 0 }; +static struct rte_flow_item eth_item_bad = { -1, 0, 0, 0 }; + +static struct rte_flow_item ipv4_udp_item_1 = { RTE_FLOW_ITEM_TYPE_IPV4, + &ipv4_udp_spec_1, 0, &ipv4_mask_24}; +static struct rte_flow_item ipv4_udp_item_bad = { RTE_FLOW_ITEM_TYPE_IPV4, + NULL, 0, NULL}; + +static struct rte_flow_item udp_item_1 = { RTE_FLOW_ITEM_TYPE_UDP, + &udp_spec_1, 0, &rte_flow_item_udp_mask}; +static struct rte_flow_item udp_item_bad = { RTE_FLOW_ITEM_TYPE_UDP, + NULL, 0, NULL}; + +static struct rte_flow_item end_item = { RTE_FLOW_ITEM_TYPE_END, + 0, 0, 0 }; +static struct rte_flow_item end_item_bad = { -1, 0, 0, 0 }; + +/* test TCP pattern: + * "eth / ipv4 src spec 1.2.3.4 src mask 255.255.255.00 dst spec 5.6.7.8 + * dst mask 255.255.255.00 / tcp src is 16 dst is 17 / end" + */ +static struct rte_flow_item_ipv4 ipv4_tcp_spec_1 = { + { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, IPv4(1, 2, 3, 4), IPv4(5, 6, 7, 8)} +}; + +static struct rte_flow_item_tcp tcp_spec_1 = { + { 16, 17, 0, 0, 0, 0, 0, 0, 0} +}; + +static struct rte_flow_item ipv4_tcp_item_1 = { RTE_FLOW_ITEM_TYPE_IPV4, + &ipv4_tcp_spec_1, 0, &ipv4_mask_24}; + +static struct rte_flow_item tcp_item_1 = { RTE_FLOW_ITEM_TYPE_TCP, + &tcp_spec_1, 0, &rte_flow_item_tcp_mask}; + +/* test SCTP pattern: + * "eth / ipv4 src spec 1.2.3.4 src mask 255.255.255.00 dst spec 5.6.7.8 + * dst mask 255.255.255.00 / sctp src is 16 dst is 17/ end" + */ +static struct rte_flow_item_ipv4 ipv4_sctp_spec_1 = { + { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, IPv4(11, 12, 13, 14), + IPv4(15, 16, 17, 18)} +}; + +static struct rte_flow_item_sctp sctp_spec_1 = { + { 10, 11, 0, 0} +}; + +static struct rte_flow_item ipv4_sctp_item_1 = { RTE_FLOW_ITEM_TYPE_IPV4, + &ipv4_sctp_spec_1, 0, &ipv4_mask_24}; + +static struct rte_flow_item sctp_item_1 = { RTE_FLOW_ITEM_TYPE_SCTP, + &sctp_spec_1, 0, &rte_flow_item_sctp_mask}; + + +/* test actions: + * "actions count / end" + */ +static struct rte_flow_action count_action = { RTE_FLOW_ACTION_TYPE_COUNT, 0}; +static struct rte_flow_action count_action_bad = { -1, 0}; + +static struct rte_flow_action end_action = { RTE_FLOW_ACTION_TYPE_END, 0}; +static struct rte_flow_action end_action_bad = { -1, 0}; + +static struct rte_flow_action actions[2]; + +/* test attributes */ +static struct rte_flow_attr attr; + +/* test error */ +static struct rte_flow_error error; + +/* test pattern */ +static struct rte_flow_item pattern[4]; + +/* flow classify data for UDP burst */ +static struct rte_flow_classify_ipv4_5tuple_stats udp_ntuple_stats; +static struct rte_flow_classify_stats udp_classify_stats = { + .stats = (void *)&udp_ntuple_stats +}; + +/* flow classify data for TCP burst */ +static struct rte_flow_classify_ipv4_5tuple_stats tcp_ntuple_stats; +static struct rte_flow_classify_stats tcp_classify_stats = { + .stats = (void *)&tcp_ntuple_stats +}; + +/* flow classify data for SCTP burst */ +static struct rte_flow_classify_ipv4_5tuple_stats sctp_ntuple_stats; +static struct rte_flow_classify_stats sctp_classify_stats = { + .stats = (void *)&sctp_ntuple_stats +}; +#endif /* TEST_FLOW_CLASSIFY_H_ */ diff --git a/test/test/test_func_reentrancy.c b/test/test/test_func_reentrancy.c index 95440dd1..514c8761 100644 --- a/test/test/test_func_reentrancy.c +++ b/test/test/test_func_reentrancy.c @@ -44,7 +44,6 @@ #include <rte_log.h> #include <rte_debug.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_launch.h> #include <rte_cycles.h> #include <rte_eal.h> diff --git a/test/test/test_hash.c b/test/test/test_hash.c index 2fafc44b..4668cf1a 100644 --- a/test/test/test_hash.c +++ b/test/test/test_hash.c @@ -44,7 +44,6 @@ #include <rte_cycles.h> #include <rte_random.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_eal.h> #include <rte_ip.h> #include <rte_string_fns.h> diff --git a/test/test/test_kni.c b/test/test/test_kni.c index db17fdf3..b9567275 100644 --- a/test/test/test_kni.c +++ b/test/test/test_kni.c @@ -42,6 +42,7 @@ #include <rte_string_fns.h> #include <rte_mempool.h> #include <rte_ethdev.h> +#include <rte_bus_pci.h> #include <rte_cycles.h> #include <rte_kni.h> @@ -132,7 +133,7 @@ test_kni_lookup_mempool(void) } /* Callback for request of changing MTU */ static int -kni_change_mtu(uint8_t port_id, unsigned new_mtu) +kni_change_mtu(uint16_t port_id, unsigned int new_mtu) { printf("Change MTU of port %d to %u\n", port_id, new_mtu); kni_pkt_mtu = new_mtu; @@ -362,7 +363,7 @@ test_kni_register_handler_mp(void) } static int -test_kni_processing(uint8_t port_id, struct rte_mempool *mp) +test_kni_processing(uint16_t port_id, struct rte_mempool *mp) { int ret = 0; unsigned i; @@ -387,7 +388,7 @@ test_kni_processing(uint8_t port_id, struct rte_mempool *mp) conf.core_id = 1; conf.force_bind = 1; conf.mbuf_size = MAX_PACKET_SZ; - conf.group_id = (uint16_t)port_id; + conf.group_id = port_id; ops = kni_ops; ops.port_id = port_id; @@ -472,7 +473,7 @@ static int test_kni(void) { int ret = -1; - uint8_t nb_ports, port_id; + uint16_t nb_ports, port_id; struct rte_kni *kni; struct rte_mempool *mp; struct rte_kni_conf conf; @@ -538,7 +539,7 @@ test_kni(void) rte_eth_dev_info_get(port_id, &info); conf.addr = info.pci_dev->addr; conf.id = info.pci_dev->id; - conf.group_id = (uint16_t)port_id; + conf.group_id = port_id; conf.mbuf_size = MAX_PACKET_SZ; ops = kni_ops; @@ -567,7 +568,7 @@ test_kni(void) rte_eth_dev_info_get(port_id, &info); conf.addr = info.pci_dev->addr; conf.id = info.pci_dev->id; - conf.group_id = (uint16_t)port_id; + conf.group_id = port_id; conf.mbuf_size = MAX_PACKET_SZ; ops = kni_ops; diff --git a/test/test/test_link_bonding.c b/test/test/test_link_bonding.c index dc28cea5..c6e3a725 100644 --- a/test/test/test_link_bonding.c +++ b/test/test/test_link_bonding.c @@ -94,9 +94,9 @@ uint8_t slave_mac[] = {0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 }; uint8_t bonded_mac[] = {0xAA, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; struct link_bonding_unittest_params { - int8_t bonded_port_id; - int8_t slave_port_ids[TEST_MAX_NUMBER_OF_PORTS]; - uint8_t bonded_slave_count; + int16_t bonded_port_id; + int16_t slave_port_ids[TEST_MAX_NUMBER_OF_PORTS]; + uint16_t bonded_slave_count; uint8_t bonding_mode; uint16_t nb_rx_q; @@ -226,7 +226,7 @@ static void free_virtualpmd_tx_queue(void); static int -configure_ethdev(uint8_t port_id, uint8_t start, uint8_t en_isr) +configure_ethdev(uint16_t port_id, uint8_t start, uint8_t en_isr) { int q_id; @@ -317,7 +317,7 @@ test_create_bonded_device(void) { int current_slave_count; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; /* Don't try to recreate bonded device if re-running test suite*/ if (test_params->bonded_port_id == -1) { @@ -387,7 +387,7 @@ test_add_slave_to_bonded_device(void) { int current_slave_count; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; TEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(test_params->bonded_port_id, test_params->slave_port_ids[test_params->bonded_slave_count]), @@ -434,7 +434,7 @@ test_remove_slave_from_bonded_device(void) { int current_slave_count; struct ether_addr read_mac_addr, *mac_addr; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; TEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove(test_params->bonded_port_id, test_params->slave_port_ids[test_params->bonded_slave_count-1]), @@ -496,7 +496,7 @@ static int test_add_already_bonded_slave_to_bonded_device(void) { int port_id, current_slave_count; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; char pmd_name[RTE_ETH_NAME_MAX_LEN]; test_add_slave_to_bonded_device(); @@ -528,7 +528,7 @@ static int test_get_slaves_from_bonded_device(void) { int current_slave_count; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; TEST_ASSERT_SUCCESS(test_add_slave_to_bonded_device(), "Failed to add slave to bonded device"); @@ -609,7 +609,7 @@ test_start_bonded_device(void) struct rte_eth_link link_status; int current_slave_count, current_bonding_mode, primary_port; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; /* Add slave to bonded device*/ TEST_ASSERT_SUCCESS(test_add_slave_to_bonded_device(), @@ -658,7 +658,7 @@ static int test_stop_bonded_device(void) { int current_slave_count; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; struct rte_eth_link link_status; @@ -932,7 +932,7 @@ test_set_bonded_port_initialization_mac_assignment(void) { int i, slave_count, bonded_port_id; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; int slave_port_ids[BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT]; struct ether_addr slave_mac_addr, bonded_mac_addr, read_mac_addr; @@ -1114,7 +1114,7 @@ test_set_bonded_port_initialization_mac_assignment(void) static int initialize_bonded_device_with_slaves(uint8_t bonding_mode, uint8_t bond_en_isr, - uint8_t number_of_slaves, uint8_t enable_slave) + uint16_t number_of_slaves, uint8_t enable_slave) { /* Configure bonded device */ TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0, @@ -1179,7 +1179,7 @@ int test_lsc_interrupt_count; static int -test_bonding_lsc_event_callback(uint8_t port_id __rte_unused, +test_bonding_lsc_event_callback(uint16_t port_id __rte_unused, enum rte_eth_event_type type __rte_unused, void *param __rte_unused, void *ret_param __rte_unused) @@ -1224,7 +1224,7 @@ static int test_status_interrupt(void) { int slave_count; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; /* initialized bonding device with T slaves */ TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( @@ -1313,7 +1313,7 @@ test_status_interrupt(void) static int generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size, uint8_t vlan, uint8_t ipv4, uint8_t toggle_dst_mac, - uint8_t toggle_ip_addr, uint8_t toggle_udp_port) + uint8_t toggle_ip_addr, uint16_t toggle_udp_port) { uint16_t pktlen, generated_burst_size, ether_type; void *ip_hdr; @@ -1854,7 +1854,7 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void) struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; int i, burst_size, slave_count; @@ -2408,7 +2408,7 @@ test_activebackup_verify_slave_link_status_change_failover(void) struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; int i, burst_size, slave_count, primary_port; @@ -3302,7 +3302,7 @@ test_balance_verify_slave_link_status_change_behaviour(void) struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; int i, burst_size, slave_count; @@ -3861,7 +3861,7 @@ test_broadcast_verify_slave_link_status_change_behaviour(void) struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; int i, burst_size, slave_count; @@ -4373,7 +4373,7 @@ test_tlb_verify_slave_link_status_change_failover(void) struct rte_mbuf *rx_pkt_burst[MAX_PKT_BURST] = { NULL }; struct rte_eth_stats port_stats; - uint8_t slaves[RTE_MAX_ETHPORTS]; + uint16_t slaves[RTE_MAX_ETHPORTS]; int i, burst_size, slave_count, primary_port; diff --git a/test/test/test_link_bonding_mode4.c b/test/test/test_link_bonding_mode4.c index 8e9e23db..a7a3f8e2 100644 --- a/test/test/test_link_bonding_mode4.c +++ b/test/test/test_link_bonding_mode4.c @@ -102,7 +102,7 @@ static const struct ether_addr slow_protocol_mac_addr = { struct slave_conf { struct rte_ring *rx_queue; struct rte_ring *tx_queue; - uint8_t port_id; + uint16_t port_id; uint8_t bonded : 1; uint8_t lacp_parnter_state; @@ -235,7 +235,7 @@ free_pkts(struct rte_mbuf **pkts, uint16_t count) } static int -configure_ethdev(uint8_t port_id, uint8_t start) +configure_ethdev(uint16_t port_id, uint8_t start) { TEST_ASSERT(rte_eth_dev_configure(port_id, 1, 1, &default_pmd_conf) == 0, "Failed to configure device %u", port_id); @@ -325,7 +325,7 @@ remove_slave(struct slave_conf *slave) } static void -lacp_recv_cb(uint8_t slave_id, struct rte_mbuf *lacp_pkt) +lacp_recv_cb(uint16_t slave_id, struct rte_mbuf *lacp_pkt) { struct ether_hdr *hdr; struct slow_protocol_frame *slow_hdr; @@ -343,7 +343,7 @@ lacp_recv_cb(uint8_t slave_id, struct rte_mbuf *lacp_pkt) } static int -initialize_bonded_device_with_slaves(uint8_t slave_count, uint8_t external_sm) +initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm) { uint8_t i; @@ -379,8 +379,8 @@ remove_slaves_and_stop_bonded_device(void) { struct slave_conf *slave; int retval; - uint8_t slaves[RTE_MAX_ETHPORTS]; - uint8_t i; + uint16_t slaves[RTE_MAX_ETHPORTS]; + uint16_t i; rte_eth_dev_stop(test_params.bonded_port_id); @@ -411,7 +411,7 @@ test_setup(void) char name[RTE_ETH_NAME_MAX_LEN]; struct slave_conf *port; const uint8_t socket_id = rte_socket_id(); - uint8_t i; + uint16_t i; if (test_params.mbuf_pool == NULL) { nb_mbuf_per_pool = TEST_RX_DESC_MAX + DEF_PKT_BURST + @@ -661,7 +661,7 @@ bond_handshake(void) TEST_ASSERT_EQUAL(all_slaves_done, 1, "Bond handshake failed\n"); /* If flags doesn't match - report failure */ - return all_slaves_done = 1 ? TEST_SUCCESS : TEST_FAILED; + return all_slaves_done == 1 ? TEST_SUCCESS : TEST_FAILED; } #define TEST_LACP_SLAVE_COUT RTE_DIM(test_params.slave_ports) @@ -1521,7 +1521,7 @@ check_environment(void) { struct slave_conf *port; uint8_t i, env_state; - uint8_t slaves[RTE_DIM(test_params.slave_ports)]; + uint16_t slaves[RTE_DIM(test_params.slave_ports)]; int slaves_count; env_state = 0; diff --git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c index f8cf1cab..54cbf128 100644 --- a/test/test/test_link_bonding_rssconf.c +++ b/test/test/test_link_bonding_rssconf.c @@ -48,6 +48,7 @@ #include <rte_log.h> #include <rte_lcore.h> #include <rte_memory.h> +#include <rte_bus_vdev.h> #include <rte_string_fns.h> #include <rte_errno.h> @@ -75,7 +76,7 @@ #define INVALID_BONDING_MODE (-1) struct slave_conf { - uint8_t port_id; + uint16_t port_id; struct rte_eth_dev_info dev_info; struct rte_eth_rss_conf rss_conf; @@ -159,7 +160,8 @@ static struct rte_eth_conf rss_pmd_conf = { RTE_DIM(test_params.slave_ports)) static int -configure_ethdev(uint8_t port_id, struct rte_eth_conf *eth_conf, uint8_t start) +configure_ethdev(uint16_t port_id, struct rte_eth_conf *eth_conf, + uint8_t start) { int rxq, txq; @@ -243,7 +245,7 @@ bond_slaves(void) * Set all RETA values in port_id to value */ static int -reta_set(uint8_t port_id, uint8_t value, int reta_size) +reta_set(uint16_t port_id, uint8_t value, int reta_size) { struct rte_eth_rss_reta_entry64 reta_conf[512/RTE_RETA_GROUP_SIZE]; int i, j; diff --git a/test/test/test_logs.c b/test/test/test_logs.c index 730a86bd..d6e4973a 100644 --- a/test/test/test_logs.c +++ b/test/test/test_logs.c @@ -38,7 +38,6 @@ #include <rte_log.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> @@ -61,9 +60,9 @@ static int test_logs(void) { - /* enable these logs type */ - rte_log_set_level(RTE_LOGTYPE_TESTAPP1, RTE_LOG_EMERG); - rte_log_set_level(RTE_LOGTYPE_TESTAPP2, RTE_LOG_EMERG); + /* set logtype level low to so we can test global level */ + rte_log_set_level(RTE_LOGTYPE_TESTAPP1, RTE_LOG_DEBUG); + rte_log_set_level(RTE_LOGTYPE_TESTAPP2, RTE_LOG_DEBUG); /* log in error level */ rte_log_set_global_level(RTE_LOG_ERR); @@ -75,8 +74,8 @@ test_logs(void) RTE_LOG(ERR, TESTAPP2, "error message (not displayed)\n"); RTE_LOG(CRIT, TESTAPP2, "critical message\n"); - /* disable one log type */ - rte_log_set_level(RTE_LOGTYPE_TESTAPP2, RTE_LOG_DEBUG); + /* bump up single log type level above global to test it */ + rte_log_set_level(RTE_LOGTYPE_TESTAPP2, RTE_LOG_EMERG); /* log in error level */ rte_log_set_global_level(RTE_LOG_ERR); diff --git a/test/test/test_malloc.c b/test/test/test_malloc.c index 013fd440..4572cafb 100644 --- a/test/test/test_malloc.c +++ b/test/test/test_malloc.c @@ -41,7 +41,6 @@ #include <rte_common.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_per_lcore.h> #include <rte_launch.h> #include <rte_eal.h> @@ -108,8 +107,7 @@ test_align_overlap_per_lcore(__attribute__((unused)) void *arg) } for(j = 0; j < 1000 ; j++) { if( *(char *)p1 != 0) { - printf("rte_zmalloc didn't zero" - "the allocated memory\n"); + printf("rte_zmalloc didn't zero the allocated memory\n"); ret = -1; } } @@ -180,8 +178,7 @@ test_reordered_free_per_lcore(__attribute__((unused)) void *arg) } for(j = 0; j < 1000 ; j++) { if( *(char *)p1 != 0) { - printf("rte_zmalloc didn't zero" - "the allocated memory\n"); + printf("rte_zmalloc didn't zero the allocated memory\n"); ret = -1; } } @@ -293,7 +290,7 @@ test_multi_alloc_statistics(void) struct rte_malloc_socket_stats pre_stats, post_stats ,first_stats, second_stats; size_t size = 2048; int align = 1024; -#ifndef RTE_LIBRTE_MALLOC_DEBUG +#ifndef RTE_MALLOC_DEBUG int trailer_size = 0; #else int trailer_size = RTE_CACHE_LINE_SIZE; @@ -623,7 +620,7 @@ test_rte_malloc_validate(void) const size_t request_size = 1024; size_t allocated_size; char *data_ptr = rte_malloc(NULL, request_size, RTE_CACHE_LINE_SIZE); -#ifdef RTE_LIBRTE_MALLOC_DEBUG +#ifdef RTE_MALLOC_DEBUG int retval; char *over_write_vals = NULL; #endif @@ -645,7 +642,7 @@ test_rte_malloc_validate(void) if (allocated_size < request_size) err_return(); -#ifdef RTE_LIBRTE_MALLOC_DEBUG +#ifdef RTE_MALLOC_DEBUG /****** change the header to be bad */ char save_buf[64]; diff --git a/test/test/test_mbuf.c b/test/test/test_mbuf.c index 3396b4a9..414509b2 100644 --- a/test/test/test_mbuf.c +++ b/test/test/test_mbuf.c @@ -45,7 +45,6 @@ #include <rte_log.h> #include <rte_memory.h> #include <rte_memcpy.h> -#include <rte_memzone.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> @@ -907,7 +906,7 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool) } badbuf = *buf; - badbuf.buf_physaddr = 0; + badbuf.buf_iova = 0; if (verify_mbuf_check_panics(&badbuf)) { printf("Error with bad-physaddr mbuf test\n"); return -1; diff --git a/test/test/test_member.c b/test/test/test_member.c new file mode 100644 index 00000000..02375fdc --- /dev/null +++ b/test/test/test_member.c @@ -0,0 +1,744 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2017 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* This test is for membership library's simple feature test */ + +#include <rte_memcpy.h> +#include <rte_malloc.h> +#include <rte_member.h> +#include <rte_byteorder.h> +#include <rte_random.h> +#include <rte_debug.h> +#include <rte_ip.h> + +#include "test.h" + +struct rte_member_setsum *setsum_ht; +struct rte_member_setsum *setsum_cache; +struct rte_member_setsum *setsum_vbf; + +/* 5-tuple key type */ +struct flow_key { + uint32_t ip_src; + uint32_t ip_dst; + uint16_t port_src; + uint16_t port_dst; + uint8_t proto; +} __attribute__((packed)); + +/* Set ID Macros for multimatch test usage */ +#define M_MATCH_S 1 /* Not start with 0 since by default 0 means no match */ +#define M_MATCH_E 15 +#define M_MATCH_STEP 2 +#define M_MATCH_CNT \ + (1 + (M_MATCH_E - M_MATCH_S) / M_MATCH_STEP) + + +#define NUM_SAMPLES 5 +#define MAX_MATCH 32 + +/* Keys used by unit test functions */ +static struct flow_key keys[NUM_SAMPLES] = { + { + .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .port_src = 0x0908, + .port_dst = 0x0b0a, + .proto = 0x0c, + }, + { + .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .port_src = 0x1918, + .port_dst = 0x1b1a, + .proto = 0x1c, + }, + { + .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .port_src = 0x2928, + .port_dst = 0x2b2a, + .proto = 0x2c, + }, + { + .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .port_src = 0x3938, + .port_dst = 0x3b3a, + .proto = 0x3c, + }, + { + .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .port_src = 0x4948, + .port_dst = 0x4b4a, + .proto = 0x4c, + } +}; + +uint32_t test_set[NUM_SAMPLES] = {1, 2, 3, 4, 5}; + +#define ITERATIONS 3 +#define KEY_SIZE 4 + +#define MAX_ENTRIES (1 << 16) +uint8_t generated_keys[MAX_ENTRIES][KEY_SIZE]; + +static struct rte_member_parameters params = { + .num_keys = MAX_ENTRIES, /* Total hash table entries. */ + .key_len = KEY_SIZE, /* Length of hash key. */ + + /* num_set and false_positive_rate only relevant to vBF */ + .num_set = 16, + .false_positive_rate = 0.03, + .prim_hash_seed = 1, + .sec_hash_seed = 11, + .socket_id = 0 /* NUMA Socket ID for memory. */ +}; + +/* + * Sequence of operations for find existing setsummary + * + * - create setsum + * - find existing setsum: hit + * - find non-existing setsum: miss + * + */ +static int +test_member_find_existing(void) +{ + struct rte_member_setsum *tmp_setsum = NULL, *result = NULL; + struct rte_member_parameters tmp_params = { + .name = "member_find_existing", + .num_keys = MAX_ENTRIES, /* Total hash table entries. */ + .key_len = KEY_SIZE, /* Length of hash key. */ + .type = RTE_MEMBER_TYPE_HT, + .num_set = 32, + .false_positive_rate = 0.03, + .prim_hash_seed = 1, + .sec_hash_seed = 11, + .socket_id = 0 /* NUMA Socket ID for memory. */ + }; + + /* Create */ + tmp_setsum = rte_member_create(&tmp_params); + TEST_ASSERT(tmp_setsum != NULL, "setsum creation failed"); + + /* Try to find existing hash table */ + result = rte_member_find_existing("member_find_existing"); + TEST_ASSERT(result == tmp_setsum, "could not find existing setsum"); + + /* Try to find non-existing hash table */ + result = rte_member_find_existing("member_find_non_existing"); + TEST_ASSERT(result == NULL, "found setsum that shouldn't exist"); + + /* Cleanup. */ + rte_member_free(tmp_setsum); + + return 0; +} + +/* + * Test for bad creating parameters + */ +static int +test_member_create_bad_param(void) +{ + struct rte_member_setsum *bad_setsum = NULL; + struct rte_member_parameters bad_params = { + .num_keys = MAX_ENTRIES, /* Total hash table entries. */ + .key_len = KEY_SIZE, /* Length of hash key. */ + .type = RTE_MEMBER_TYPE_HT, + .num_set = 32, + .false_positive_rate = 0.03, + .prim_hash_seed = 1, + .sec_hash_seed = 11, + .socket_id = 0 /* NUMA Socket ID for memory. */ + }; + + printf("Expected error section begin...\n"); + bad_params.name = "bad_param1"; + bad_params.num_set = 0; + bad_params.type = RTE_MEMBER_TYPE_VBF; + /* Test with 0 set for vBF should fail */ + bad_setsum = rte_member_create(&bad_params); + if (bad_setsum != NULL) { + rte_member_free(bad_setsum); + printf("Impossible creating setsum successfully with invalid " + "number of set for vBF\n"); + return -1; + } + + bad_params.name = "bad_param2"; + bad_params.false_positive_rate = 0; + bad_params.num_set = 32; + /* Test with 0 false positive for vBF should fail */ + bad_setsum = rte_member_create(&bad_params); + if (bad_setsum != NULL) { + rte_member_free(bad_setsum); + printf("Impossible creating setsum successfully with invalid " + "false positive rate for vBF\n"); + return -1; + } + + bad_params.name = "bad_param3"; + bad_params.false_positive_rate = 0.03; + bad_params.num_keys = 0; + /* Test with 0 key per BF for vBF should fail */ + bad_setsum = rte_member_create(&bad_params); + if (bad_setsum != NULL) { + rte_member_free(bad_setsum); + printf("Impossible creating setsum successfully with invalid " + "num_keys for vBF\n"); + return -1; + } + + bad_params.name = "bad_param4"; + bad_params.type = RTE_MEMBER_TYPE_HT; + bad_params.num_keys = RTE_MEMBER_BUCKET_ENTRIES / 2; + /* Test with less than 1 bucket for HTSS should fail */ + bad_setsum = rte_member_create(&bad_params); + if (bad_setsum != NULL) { + rte_member_free(bad_setsum); + printf("Impossible creating setsum successfully with too few " + "number of keys(entries) for HT\n"); + return -1; + } + + bad_params.name = "bad_param5"; + bad_params.num_keys = RTE_MEMBER_ENTRIES_MAX + 1; + /* Test with more than maximum entries for HTSS should fail */ + bad_setsum = rte_member_create(&bad_params); + if (bad_setsum != NULL) { + rte_member_free(bad_setsum); + printf("Impossible creating setsum successfully with to many " + "number of keys(entries) for HT\n"); + return -1; + } + + bad_params.name = "bad_param5"; + /* Test with same name should fail */ + bad_setsum = rte_member_create(&bad_params); + if (bad_setsum != NULL) { + rte_member_free(bad_setsum); + printf("Impossible creating setsum successfully with existed " + "name\n"); + return -1; + } + printf("Expected error section end...\n"); + rte_member_free(bad_setsum); + return 0; +} + +/* Create test setsummaries. */ +static int test_member_create(void) +{ + params.key_len = sizeof(struct flow_key); + + params.name = "test_member_ht"; + params.is_cache = 0; + params.type = RTE_MEMBER_TYPE_HT; + setsum_ht = rte_member_create(¶ms); + + params.name = "test_member_cache"; + params.is_cache = 1; + setsum_cache = rte_member_create(¶ms); + + params.name = "test_member_vbf"; + params.type = RTE_MEMBER_TYPE_VBF; + setsum_vbf = rte_member_create(¶ms); + + if (setsum_ht == NULL || setsum_cache == NULL || setsum_vbf == NULL) { + printf("Creation of setsums fail\n"); + return -1; + } + printf("Creation of setsums success\n"); + return 0; +} + +static int test_member_insert(void) +{ + int ret_ht, ret_cache, ret_vbf, i; + + for (i = 0; i < NUM_SAMPLES; i++) { + ret_ht = rte_member_add(setsum_ht, &keys[i], test_set[i]); + ret_cache = rte_member_add(setsum_cache, &keys[i], + test_set[i]); + ret_vbf = rte_member_add(setsum_vbf, &keys[i], test_set[i]); + TEST_ASSERT(ret_ht >= 0 && ret_cache >= 0 && ret_vbf >= 0, + "insert error"); + } + printf("insert key success\n"); + return 0; +} + +static int test_member_lookup(void) +{ + int ret_ht, ret_cache, ret_vbf, i; + uint16_t set_ht, set_cache, set_vbf; + member_set_t set_ids_ht[NUM_SAMPLES] = {0}; + member_set_t set_ids_cache[NUM_SAMPLES] = {0}; + member_set_t set_ids_vbf[NUM_SAMPLES] = {0}; + + uint32_t num_key_ht = NUM_SAMPLES; + uint32_t num_key_cache = NUM_SAMPLES; + uint32_t num_key_vbf = NUM_SAMPLES; + + const void *key_array[NUM_SAMPLES]; + + /* Single lookup test */ + for (i = 0; i < NUM_SAMPLES; i++) { + ret_ht = rte_member_lookup(setsum_ht, &keys[i], &set_ht); + ret_cache = rte_member_lookup(setsum_cache, &keys[i], + &set_cache); + ret_vbf = rte_member_lookup(setsum_vbf, &keys[i], &set_vbf); + TEST_ASSERT(ret_ht >= 0 && ret_cache >= 0 && ret_vbf >= 0, + "single lookup function error"); + + TEST_ASSERT(set_ht == test_set[i] && + set_cache == test_set[i] && + set_vbf == test_set[i], + "single lookup set value error"); + } + printf("lookup single key success\n"); + + /* Bulk lookup test */ + for (i = 0; i < NUM_SAMPLES; i++) + key_array[i] = &keys[i]; + + ret_ht = rte_member_lookup_bulk(setsum_ht, key_array, + num_key_ht, set_ids_ht); + + ret_cache = rte_member_lookup_bulk(setsum_cache, key_array, + num_key_cache, set_ids_cache); + + ret_vbf = rte_member_lookup_bulk(setsum_vbf, key_array, + num_key_vbf, set_ids_vbf); + + TEST_ASSERT(ret_ht >= 0 && ret_cache >= 0 && ret_vbf >= 0, + "bulk lookup function error"); + + for (i = 0; i < NUM_SAMPLES; i++) { + TEST_ASSERT((set_ids_ht[i] == test_set[i]) && + (set_ids_cache[i] == test_set[i]) && + (set_ids_vbf[i] == test_set[i]), + "bulk lookup result error"); + } + + return 0; +} + +static int test_member_delete(void) +{ + int ret_ht, ret_cache, ret_vbf, i; + uint16_t set_ht, set_cache, set_vbf; + const void *key_array[NUM_SAMPLES]; + member_set_t set_ids_ht[NUM_SAMPLES] = {0}; + member_set_t set_ids_cache[NUM_SAMPLES] = {0}; + member_set_t set_ids_vbf[NUM_SAMPLES] = {0}; + uint32_t num_key_ht = NUM_SAMPLES; + uint32_t num_key_cache = NUM_SAMPLES; + uint32_t num_key_vbf = NUM_SAMPLES; + + /* Delete part of all inserted keys */ + for (i = 0; i < NUM_SAMPLES / 2; i++) { + ret_ht = rte_member_delete(setsum_ht, &keys[i], test_set[i]); + ret_cache = rte_member_delete(setsum_cache, &keys[i], + test_set[i]); + ret_vbf = rte_member_delete(setsum_vbf, &keys[i], test_set[i]); + /* VBF does not support delete yet, so return error code */ + TEST_ASSERT(ret_ht >= 0 && ret_cache >= 0, + "key deletion function error"); + TEST_ASSERT(ret_vbf < 0, + "vbf does not support deletion, error"); + } + + for (i = 0; i < NUM_SAMPLES; i++) + key_array[i] = &keys[i]; + + ret_ht = rte_member_lookup_bulk(setsum_ht, key_array, + num_key_ht, set_ids_ht); + + ret_cache = rte_member_lookup_bulk(setsum_cache, key_array, + num_key_cache, set_ids_cache); + + ret_vbf = rte_member_lookup_bulk(setsum_vbf, key_array, + num_key_vbf, set_ids_vbf); + + TEST_ASSERT(ret_ht >= 0 && ret_cache >= 0 && ret_vbf >= 0, + "bulk lookup function error"); + + for (i = 0; i < NUM_SAMPLES / 2; i++) { + TEST_ASSERT((set_ids_ht[i] == RTE_MEMBER_NO_MATCH) && + (set_ids_cache[i] == RTE_MEMBER_NO_MATCH), + "bulk lookup result error"); + } + + for (i = NUM_SAMPLES / 2; i < NUM_SAMPLES; i++) { + TEST_ASSERT((set_ids_ht[i] == test_set[i]) && + (set_ids_cache[i] == test_set[i]) && + (set_ids_vbf[i] == test_set[i]), + "bulk lookup result error"); + } + + /* Delete the left of inserted keys */ + for (i = NUM_SAMPLES / 2; i < NUM_SAMPLES; i++) { + ret_ht = rte_member_delete(setsum_ht, &keys[i], test_set[i]); + ret_cache = rte_member_delete(setsum_cache, &keys[i], + test_set[i]); + ret_vbf = rte_member_delete(setsum_vbf, &keys[i], test_set[i]); + /* VBF does not support delete yet, so return error code */ + TEST_ASSERT(ret_ht >= 0 && ret_cache >= 0, + "key deletion function error"); + TEST_ASSERT(ret_vbf < 0, + "vbf does not support deletion, error"); + } + + for (i = 0; i < NUM_SAMPLES; i++) { + ret_ht = rte_member_lookup(setsum_ht, &keys[i], &set_ht); + ret_cache = rte_member_lookup(setsum_cache, &keys[i], + &set_cache); + ret_vbf = rte_member_lookup(setsum_vbf, &keys[i], &set_vbf); + TEST_ASSERT(ret_ht >= 0 && ret_cache >= 0, + "key lookup function error"); + TEST_ASSERT(set_ht == RTE_MEMBER_NO_MATCH && + ret_cache == RTE_MEMBER_NO_MATCH, + "key deletion failed"); + } + /* Reset vbf for other following tests */ + rte_member_reset(setsum_vbf); + + printf("delete success\n"); + return 0; +} + +static int test_member_multimatch(void) +{ + int ret_ht, ret_vbf, ret_cache; + member_set_t set_ids_ht[MAX_MATCH] = {0}; + member_set_t set_ids_vbf[MAX_MATCH] = {0}; + member_set_t set_ids_cache[MAX_MATCH] = {0}; + + member_set_t set_ids_ht_m[NUM_SAMPLES][MAX_MATCH] = {{0} }; + member_set_t set_ids_vbf_m[NUM_SAMPLES][MAX_MATCH] = {{0} }; + member_set_t set_ids_cache_m[NUM_SAMPLES][MAX_MATCH] = {{0} }; + + uint32_t match_count_ht[NUM_SAMPLES]; + uint32_t match_count_vbf[NUM_SAMPLES]; + uint32_t match_count_cache[NUM_SAMPLES]; + + uint32_t num_key_ht = NUM_SAMPLES; + uint32_t num_key_vbf = NUM_SAMPLES; + uint32_t num_key_cache = NUM_SAMPLES; + + const void *key_array[NUM_SAMPLES]; + + uint32_t i, j; + + /* Same key at most inserted 2*entry_per_bucket times for HT mode */ + for (i = M_MATCH_S; i <= M_MATCH_E; i += M_MATCH_STEP) { + for (j = 0; j < NUM_SAMPLES; j++) { + ret_ht = rte_member_add(setsum_ht, &keys[j], i); + ret_vbf = rte_member_add(setsum_vbf, &keys[j], i); + ret_cache = rte_member_add(setsum_cache, &keys[j], i); + + TEST_ASSERT(ret_ht >= 0 && ret_vbf >= 0 && + ret_cache >= 0, + "insert function error"); + } + } + + /* Single multimatch test */ + for (i = 0; i < NUM_SAMPLES; i++) { + ret_vbf = rte_member_lookup_multi(setsum_vbf, &keys[i], + MAX_MATCH, set_ids_vbf); + ret_ht = rte_member_lookup_multi(setsum_ht, &keys[i], + MAX_MATCH, set_ids_ht); + ret_cache = rte_member_lookup_multi(setsum_cache, &keys[i], + MAX_MATCH, set_ids_cache); + /* + * For cache mode, keys overwrite when signature same. + * the mutimatch should work like single match. + */ + TEST_ASSERT(ret_ht == M_MATCH_CNT && ret_vbf == M_MATCH_CNT && + ret_cache == 1, + "single lookup_multi error"); + TEST_ASSERT(set_ids_cache[0] == M_MATCH_E, + "single lookup_multi cache error"); + + for (j = 1; j <= M_MATCH_CNT; j++) { + TEST_ASSERT(set_ids_ht[j-1] == j * M_MATCH_STEP - 1 && + set_ids_vbf[j-1] == + j * M_MATCH_STEP - 1, + "single multimatch lookup error"); + } + } + printf("lookup single key for multimatch success\n"); + + /* Bulk multimatch test */ + for (i = 0; i < NUM_SAMPLES; i++) + key_array[i] = &keys[i]; + ret_vbf = rte_member_lookup_multi_bulk(setsum_vbf, + &key_array[0], num_key_ht, MAX_MATCH, match_count_vbf, + (member_set_t *)set_ids_vbf_m); + + ret_ht = rte_member_lookup_multi_bulk(setsum_ht, + &key_array[0], num_key_vbf, MAX_MATCH, match_count_ht, + (member_set_t *)set_ids_ht_m); + + ret_cache = rte_member_lookup_multi_bulk(setsum_cache, + &key_array[0], num_key_cache, MAX_MATCH, + match_count_cache, (member_set_t *)set_ids_cache_m); + + + for (j = 0; j < NUM_SAMPLES; j++) { + TEST_ASSERT(match_count_ht[j] == M_MATCH_CNT, + "bulk multimatch lookup HT match count error"); + TEST_ASSERT(match_count_vbf[j] == M_MATCH_CNT, + "bulk multimatch lookup vBF match count error"); + TEST_ASSERT(match_count_cache[j] == 1, + "bulk multimatch lookup CACHE match count error"); + TEST_ASSERT(set_ids_cache_m[j][0] == M_MATCH_E, + "bulk multimatch lookup CACHE set value error"); + + for (i = 1; i <= M_MATCH_CNT; i++) { + TEST_ASSERT(set_ids_ht_m[j][i-1] == + i * M_MATCH_STEP - 1, + "bulk multimatch lookup HT set value error"); + TEST_ASSERT(set_ids_vbf_m[j][i-1] == + i * M_MATCH_STEP - 1, + "bulk multimatch lookup vBF set value error"); + } + } + + printf("lookup for bulk multimatch success\n"); + + return 0; +} + +static int key_compare(const void *key1, const void *key2) +{ + return memcmp(key1, key2, KEY_SIZE); +} + +static void +setup_keys_and_data(void) +{ + unsigned int i, j; + int num_duplicates; + + /* Reset all arrays */ + for (i = 0; i < KEY_SIZE; i++) + generated_keys[0][i] = 0; + + /* Generate a list of keys, some of which may be duplicates */ + for (i = 0; i < MAX_ENTRIES; i++) { + for (j = 0; j < KEY_SIZE; j++) + generated_keys[i][j] = rte_rand() & 0xFF; + } + + /* Remove duplicates from the keys array */ + do { + num_duplicates = 0; + /* Sort the list of keys to make it easier to find duplicates */ + qsort(generated_keys, MAX_ENTRIES, KEY_SIZE, key_compare); + + /* Sift through the list of keys and look for duplicates */ + int num_duplicates = 0; + for (i = 0; i < MAX_ENTRIES - 1; i++) { + if (memcmp(generated_keys[i], generated_keys[i + 1], + KEY_SIZE) == 0) { + /* This key already exists, try again */ + num_duplicates++; + for (j = 0; j < KEY_SIZE; j++) + generated_keys[i][j] = + rte_rand() & 0xFF; + } + } + } while (num_duplicates != 0); +} + +static inline int +add_generated_keys(struct rte_member_setsum *setsum, unsigned int *added_keys) +{ + int ret = 0; + + for (*added_keys = 0; ret >= 0 && *added_keys < MAX_ENTRIES; + (*added_keys)++) { + uint16_t set = (rte_rand() & 0xf) + 1; + ret = rte_member_add(setsum, &generated_keys[*added_keys], set); + } + return ret; +} + +static inline int +add_generated_keys_cache(struct rte_member_setsum *setsum, + unsigned int *added_keys) +{ + int ret = 0; + + for (*added_keys = 0; ret == 0 && *added_keys < MAX_ENTRIES; + (*added_keys)++) { + uint16_t set = (rte_rand() & 0xf) + 1; + ret = rte_member_add(setsum, &generated_keys[*added_keys], set); + } + return ret; +} + +static int +test_member_loadfactor(void) +{ + unsigned int j; + unsigned int added_keys, average_keys_added = 0; + int ret; + + setup_keys_and_data(); + + rte_member_free(setsum_ht); + rte_member_free(setsum_cache); + rte_member_free(setsum_vbf); + + params.key_len = KEY_SIZE; + params.name = "test_member_ht"; + params.is_cache = 0; + params.type = RTE_MEMBER_TYPE_HT; + setsum_ht = rte_member_create(¶ms); + + params.name = "test_member_cache"; + params.is_cache = 1; + setsum_cache = rte_member_create(¶ms); + + + if (setsum_ht == NULL || setsum_cache == NULL) { + printf("Creation of setsums fail\n"); + return -1; + } + /* Test HT non-cache mode */ + for (j = 0; j < ITERATIONS; j++) { + /* Add random entries until key cannot be added */ + ret = add_generated_keys(setsum_ht, &added_keys); + if (ret != -ENOSPC) { + printf("Unexpected error when adding keys\n"); + return -1; + } + average_keys_added += added_keys; + + /* Reset the table */ + rte_member_reset(setsum_ht); + + /* Print a dot to show progress on operations */ + printf("."); + fflush(stdout); + } + + average_keys_added /= ITERATIONS; + + printf("\nKeys inserted when no space(non-cache) = %.2f%% (%u/%u)\n", + ((double) average_keys_added / params.num_keys * 100), + average_keys_added, params.num_keys); + + /* Test cache mode */ + added_keys = average_keys_added = 0; + for (j = 0; j < ITERATIONS; j++) { + /* Add random entries until key cannot be added */ + ret = add_generated_keys_cache(setsum_cache, &added_keys); + if (ret != 1) { + printf("Unexpected error when adding keys\n"); + return -1; + } + average_keys_added += added_keys; + + /* Reset the table */ + rte_member_reset(setsum_cache); + + /* Print a dot to show progress on operations */ + printf("."); + fflush(stdout); + } + + average_keys_added /= ITERATIONS; + + printf("\nKeys inserted when eviction happens(cache)= %.2f%% (%u/%u)\n", + ((double) average_keys_added / params.num_keys * 100), + average_keys_added, params.num_keys); + return 0; +} + +static void +perform_free(void) +{ + rte_member_free(setsum_ht); + rte_member_free(setsum_cache); + rte_member_free(setsum_vbf); +} + +static int +test_member(void) +{ + if (test_member_create_bad_param() < 0) + return -1; + + if (test_member_find_existing() < 0) + return -1; + + if (test_member_create() < 0) { + perform_free(); + return -1; + } + if (test_member_insert() < 0) { + perform_free(); + return -1; + } + if (test_member_lookup() < 0) { + perform_free(); + return -1; + } + if (test_member_delete() < 0) { + perform_free(); + return -1; + } + if (test_member_multimatch() < 0) { + perform_free(); + return -1; + } + if (test_member_loadfactor() < 0) { + rte_member_free(setsum_ht); + rte_member_free(setsum_cache); + return -1; + } + + perform_free(); + return 0; +} + +REGISTER_TEST_COMMAND(member_autotest, test_member); diff --git a/test/test/test_member_perf.c b/test/test/test_member_perf.c new file mode 100644 index 00000000..e13066f1 --- /dev/null +++ b/test/test/test_member_perf.c @@ -0,0 +1,654 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2017 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <stdio.h> +#include <inttypes.h> + +#include <rte_lcore.h> +#include <rte_cycles.h> +#include <rte_malloc.h> +#include <rte_random.h> +#include <rte_memcpy.h> +#include <rte_thash.h> +#include <rte_member.h> + +#include "test.h" + +#define NUM_KEYSIZES 10 +#define NUM_SHUFFLES 10 +#define MAX_KEYSIZE 64 +#define MAX_ENTRIES (1 << 19) +#define KEYS_TO_ADD (MAX_ENTRIES * 75 / 100) /* 75% table utilization */ +#define NUM_LOOKUPS (KEYS_TO_ADD * 5) /* Loop among keys added, several times */ +#define VBF_SET_CNT 16 +#define BURST_SIZE 64 +#define VBF_FALSE_RATE 0.03 + +static unsigned int test_socket_id; + +enum sstype { + HT = 0, + CACHE, + VBF, + NUM_TYPE +}; + +enum operations { + ADD = 0, + LOOKUP, + LOOKUP_BULK, + LOOKUP_MULTI, + LOOKUP_MULTI_BULK, + DELETE, + LOOKUP_MISS, + NUM_OPERATIONS +}; + +struct member_perf_params { + struct rte_member_setsum *setsum[NUM_TYPE]; + uint32_t key_size; + unsigned int cycle; +}; + +static uint32_t hashtest_key_lens[] = { + /* standard key sizes */ + 4, 8, 16, 32, 48, 64, + /* IPv4 SRC + DST + protocol, unpadded */ + 9, + /* IPv4 5-tuple, unpadded */ + 13, + /* IPv6 5-tuple, unpadded */ + 37, + /* IPv6 5-tuple, padded to 8-byte boundary */ + 40 +}; + +/* Array to store number of cycles per operation */ +uint64_t cycles[NUM_TYPE][NUM_KEYSIZES][NUM_OPERATIONS]; +uint64_t false_data[NUM_TYPE][NUM_KEYSIZES]; +uint64_t false_data_bulk[NUM_TYPE][NUM_KEYSIZES]; +uint64_t false_data_multi[NUM_TYPE][NUM_KEYSIZES]; +uint64_t false_data_multi_bulk[NUM_TYPE][NUM_KEYSIZES]; + +uint64_t false_hit[NUM_TYPE][NUM_KEYSIZES]; + +member_set_t data[NUM_TYPE][/* Array to store the data */KEYS_TO_ADD]; + +/* Array to store all input keys */ +uint8_t keys[KEYS_TO_ADD][MAX_KEYSIZE]; + +/* Shuffle the keys that have been added, so lookups will be totally random */ +static void +shuffle_input_keys(struct member_perf_params *params) +{ + member_set_t temp_data; + unsigned int i, j; + uint32_t swap_idx; + uint8_t temp_key[MAX_KEYSIZE]; + + for (i = KEYS_TO_ADD - 1; i > 0; i--) { + swap_idx = rte_rand() % i; + memcpy(temp_key, keys[i], hashtest_key_lens[params->cycle]); + memcpy(keys[i], keys[swap_idx], + hashtest_key_lens[params->cycle]); + memcpy(keys[swap_idx], temp_key, + hashtest_key_lens[params->cycle]); + for (j = 0; j < NUM_TYPE; j++) { + temp_data = data[j][i]; + data[j][i] = data[j][swap_idx]; + data[j][swap_idx] = temp_data; + } + } +} + +static int key_compare(const void *key1, const void *key2) +{ + return memcmp(key1, key2, MAX_KEYSIZE); +} + +struct rte_member_parameters member_params = { + .num_keys = MAX_ENTRIES, /* Total hash table entries. */ + .key_len = 4, /* Length of hash key. */ + + /* num_set and false_positive_rate only relevant to vBF */ + .num_set = VBF_SET_CNT, + .false_positive_rate = 0.03, + .prim_hash_seed = 0, + .sec_hash_seed = 1, + .socket_id = 0, /* NUMA Socket ID for memory. */ + }; + +static int +setup_keys_and_data(struct member_perf_params *params, unsigned int cycle, + int miss) +{ + unsigned int i, j; + int num_duplicates; + + params->key_size = hashtest_key_lens[cycle]; + params->cycle = cycle; + + /* Reset all arrays */ + for (i = 0; i < params->key_size; i++) + keys[0][i] = 0; + + /* Generate a list of keys, some of which may be duplicates */ + for (i = 0; i < KEYS_TO_ADD; i++) { + for (j = 0; j < params->key_size; j++) + keys[i][j] = rte_rand() & 0xFF; + + data[HT][i] = data[CACHE][i] = (rte_rand() & 0x7FFE) + 1; + data[VBF][i] = rte_rand() % VBF_SET_CNT + 1; + } + + /* Remove duplicates from the keys array */ + do { + num_duplicates = 0; + + /* Sort the list of keys to make it easier to find duplicates */ + qsort(keys, KEYS_TO_ADD, MAX_KEYSIZE, key_compare); + + /* Sift through the list of keys and look for duplicates */ + int num_duplicates = 0; + for (i = 0; i < KEYS_TO_ADD - 1; i++) { + if (memcmp(keys[i], keys[i + 1], + params->key_size) == 0) { + /* This key already exists, try again */ + num_duplicates++; + for (j = 0; j < params->key_size; j++) + keys[i][j] = rte_rand() & 0xFF; + } + } + } while (num_duplicates != 0); + + /* Shuffle the random values again */ + shuffle_input_keys(params); + + /* For testing miss lookup, we insert half and lookup the other half */ + unsigned int entry_cnt, bf_key_cnt; + if (!miss) { + entry_cnt = MAX_ENTRIES; + bf_key_cnt = KEYS_TO_ADD; + } else { + entry_cnt = MAX_ENTRIES / 2; + bf_key_cnt = KEYS_TO_ADD / 2; + } + member_params.false_positive_rate = VBF_FALSE_RATE; + member_params.key_len = params->key_size; + member_params.socket_id = test_socket_id; + member_params.num_keys = entry_cnt; + member_params.name = "test_member_ht"; + member_params.is_cache = 0; + member_params.type = RTE_MEMBER_TYPE_HT; + params->setsum[HT] = rte_member_create(&member_params); + if (params->setsum[HT] == NULL) + fprintf(stderr, "ht create fail\n"); + + member_params.name = "test_member_cache"; + member_params.is_cache = 1; + params->setsum[CACHE] = rte_member_create(&member_params); + if (params->setsum[CACHE] == NULL) + fprintf(stderr, "CACHE create fail\n"); + + member_params.name = "test_member_vbf"; + member_params.type = RTE_MEMBER_TYPE_VBF; + member_params.num_keys = bf_key_cnt; + params->setsum[VBF] = rte_member_create(&member_params); + if (params->setsum[VBF] == NULL) + fprintf(stderr, "VBF create fail\n"); + for (i = 0; i < NUM_TYPE; i++) { + if (params->setsum[i] == NULL) + return -1; + } + + return 0; +} + +static int +timed_adds(struct member_perf_params *params, int type) +{ + const uint64_t start_tsc = rte_rdtsc(); + unsigned int i, a; + int32_t ret; + + for (i = 0; i < KEYS_TO_ADD; i++) { + ret = rte_member_add(params->setsum[type], &keys[i], + data[type][i]); + if (ret < 0) { + printf("Error %d in rte_member_add - key=0x", ret); + for (a = 0; a < params->key_size; a++) + printf("%02x", keys[i][a]); + printf(" value=%d, type: %d\n", data[type][i], type); + + return -1; + } + } + + const uint64_t end_tsc = rte_rdtsc(); + const uint64_t time_taken = end_tsc - start_tsc; + + cycles[type][params->cycle][ADD] = time_taken / KEYS_TO_ADD; + return 0; +} + +static int +timed_lookups(struct member_perf_params *params, int type) +{ + unsigned int i, j; + + false_data[type][params->cycle] = 0; + + const uint64_t start_tsc = rte_rdtsc(); + member_set_t result; + int ret; + + for (i = 0; i < NUM_LOOKUPS / KEYS_TO_ADD; i++) { + for (j = 0; j < KEYS_TO_ADD; j++) { + ret = rte_member_lookup(params->setsum[type], &keys[j], + &result); + if (ret < 0) { + printf("lookup wrong internally"); + return -1; + } + if (type == HT && result == RTE_MEMBER_NO_MATCH) { + printf("HT mode shouldn't have false negative"); + return -1; + } + if (result != data[type][j]) + false_data[type][params->cycle]++; + } + } + + const uint64_t end_tsc = rte_rdtsc(); + const uint64_t time_taken = end_tsc - start_tsc; + + cycles[type][params->cycle][LOOKUP] = time_taken / NUM_LOOKUPS; + + return 0; +} + +static int +timed_lookups_bulk(struct member_perf_params *params, int type) +{ + unsigned int i, j, k; + member_set_t result[BURST_SIZE] = {0}; + const void *keys_burst[BURST_SIZE]; + int ret; + + false_data_bulk[type][params->cycle] = 0; + + const uint64_t start_tsc = rte_rdtsc(); + + for (i = 0; i < NUM_LOOKUPS / KEYS_TO_ADD; i++) { + for (j = 0; j < KEYS_TO_ADD / BURST_SIZE; j++) { + for (k = 0; k < BURST_SIZE; k++) + keys_burst[k] = keys[j * BURST_SIZE + k]; + + ret = rte_member_lookup_bulk(params->setsum[type], + keys_burst, + BURST_SIZE, + result); + if (ret <= 0) { + printf("lookup bulk has wrong return value\n"); + return -1; + } + for (k = 0; k < BURST_SIZE; k++) { + uint32_t data_idx = j * BURST_SIZE + k; + if (type == HT && result[k] == + RTE_MEMBER_NO_MATCH) { + printf("HT mode shouldn't have " + "false negative"); + return -1; + } + if (result[k] != data[type][data_idx]) + false_data_bulk[type][params->cycle]++; + } + } + } + + const uint64_t end_tsc = rte_rdtsc(); + const uint64_t time_taken = end_tsc - start_tsc; + + cycles[type][params->cycle][LOOKUP_BULK] = time_taken / NUM_LOOKUPS; + + return 0; +} + +static int +timed_lookups_multimatch(struct member_perf_params *params, int type) +{ + unsigned int i, j; + member_set_t result[RTE_MEMBER_BUCKET_ENTRIES] = {0}; + int ret; + false_data_multi[type][params->cycle] = 0; + + const uint64_t start_tsc = rte_rdtsc(); + + for (i = 0; i < NUM_LOOKUPS / KEYS_TO_ADD; i++) { + for (j = 0; j < KEYS_TO_ADD; j++) { + ret = rte_member_lookup_multi(params->setsum[type], + &keys[j], RTE_MEMBER_BUCKET_ENTRIES, result); + if (type != CACHE && ret <= 0) { + printf("lookup multi has wrong return value %d," + "type %d\n", ret, type); + } + if (type == HT && ret == 0) { + printf("HT mode shouldn't have false negative"); + return -1; + } + /* + * For performance test purpose, we do not iterate all + * results here. We assume most likely each key can only + * find one match which is result[0]. + */ + if (result[0] != data[type][j]) + false_data_multi[type][params->cycle]++; + } + } + + const uint64_t end_tsc = rte_rdtsc(); + const uint64_t time_taken = end_tsc - start_tsc; + + cycles[type][params->cycle][LOOKUP_MULTI] = time_taken / NUM_LOOKUPS; + + return 0; +} + +static int +timed_lookups_multimatch_bulk(struct member_perf_params *params, int type) +{ + unsigned int i, j, k; + member_set_t result[BURST_SIZE][RTE_MEMBER_BUCKET_ENTRIES] = {{0} }; + const void *keys_burst[BURST_SIZE]; + uint32_t match_count[BURST_SIZE]; + int ret; + + false_data_multi_bulk[type][params->cycle] = 0; + + const uint64_t start_tsc = rte_rdtsc(); + + for (i = 0; i < NUM_LOOKUPS / KEYS_TO_ADD; i++) { + for (j = 0; j < KEYS_TO_ADD / BURST_SIZE; j++) { + for (k = 0; k < BURST_SIZE; k++) + keys_burst[k] = keys[j * BURST_SIZE + k]; + + ret = rte_member_lookup_multi_bulk( + params->setsum[type], + keys_burst, BURST_SIZE, + RTE_MEMBER_BUCKET_ENTRIES, match_count, + (member_set_t *)result); + if (ret < 0) { + printf("lookup multimatch bulk has wrong return" + " value\n"); + return -1; + } + for (k = 0; k < BURST_SIZE; k++) { + if (type != CACHE && match_count[k] == 0) { + printf("lookup multimatch bulk get " + "wrong match count\n"); + return -1; + } + if (type == HT && match_count[k] == 0) { + printf("HT mode shouldn't have " + "false negative"); + return -1; + } + uint32_t data_idx = j * BURST_SIZE + k; + if (result[k][0] != data[type][data_idx]) + false_data_multi_bulk[type][params->cycle]++; + } + } + } + + const uint64_t end_tsc = rte_rdtsc(); + const uint64_t time_taken = end_tsc - start_tsc; + + cycles[type][params->cycle][LOOKUP_MULTI_BULK] = time_taken / + NUM_LOOKUPS; + + return 0; +} + +static int +timed_deletes(struct member_perf_params *params, int type) +{ + unsigned int i; + int32_t ret; + + if (type == VBF) + return 0; + const uint64_t start_tsc = rte_rdtsc(); + for (i = 0; i < KEYS_TO_ADD; i++) { + ret = rte_member_delete(params->setsum[type], &keys[i], + data[type][i]); + if (type != CACHE && ret < 0) { + printf("delete error\n"); + return -1; + } + } + + const uint64_t end_tsc = rte_rdtsc(); + const uint64_t time_taken = end_tsc - start_tsc; + + cycles[type][params->cycle][DELETE] = time_taken / KEYS_TO_ADD; + + return 0; +} + +static int +timed_miss_lookup(struct member_perf_params *params, int type) +{ + unsigned int i, j; + int ret; + + false_hit[type][params->cycle] = 0; + + for (i = 0; i < KEYS_TO_ADD / 2; i++) { + ret = rte_member_add(params->setsum[type], &keys[i], + data[type][i]); + if (ret < 0) { + unsigned int a; + printf("Error %d in rte_member_add - key=0x", ret); + for (a = 0; a < params->key_size; a++) + printf("%02x", keys[i][a]); + printf(" value=%d, type: %d\n", data[type][i], type); + + return -1; + } + } + + const uint64_t start_tsc = rte_rdtsc(); + member_set_t result; + + for (i = 0; i < 2 * NUM_LOOKUPS / KEYS_TO_ADD; i++) { + for (j = KEYS_TO_ADD / 2; j < KEYS_TO_ADD; j++) { + ret = rte_member_lookup(params->setsum[type], &keys[j], + &result); + if (ret < 0) { + printf("lookup wrong internally"); + return -1; + } + if (result != RTE_MEMBER_NO_MATCH) + false_hit[type][params->cycle]++; + } + } + + const uint64_t end_tsc = rte_rdtsc(); + const uint64_t time_taken = end_tsc - start_tsc; + + cycles[type][params->cycle][LOOKUP_MISS] = time_taken / NUM_LOOKUPS; + + return 0; +} + +static void +perform_frees(struct member_perf_params *params) +{ + int i; + for (i = 0; i < NUM_TYPE; i++) { + if (params->setsum[i] != NULL) { + rte_member_free(params->setsum[i]); + params->setsum[i] = NULL; + } + } +} + +static int +exit_with_fail(const char *testname, struct member_perf_params *params, + unsigned int i, unsigned int j) +{ + printf("<<<<<Test %s failed at keysize %d iteration %d type %d>>>>>\n", + testname, hashtest_key_lens[params->cycle], i, j); + perform_frees(params); + return -1; +} + +static int +run_all_tbl_perf_tests(void) +{ + unsigned int i, j, k; + struct member_perf_params params; + + printf("Measuring performance, please wait\n"); + fflush(stdout); + + test_socket_id = rte_socket_id(); + + for (i = 0; i < NUM_KEYSIZES; i++) { + if (setup_keys_and_data(¶ms, i, 0) < 0) { + printf("Could not create keys/data/table\n"); + return -1; + } + for (j = 0; j < NUM_TYPE; j++) { + + if (timed_adds(¶ms, j) < 0) + return exit_with_fail("timed_adds", ¶ms, + i, j); + + for (k = 0; k < NUM_SHUFFLES; k++) + shuffle_input_keys(¶ms); + + if (timed_lookups(¶ms, j) < 0) + return exit_with_fail("timed_lookups", ¶ms, + i, j); + + if (timed_lookups_bulk(¶ms, j) < 0) + return exit_with_fail("timed_lookups_bulk", + ¶ms, i, j); + + if (timed_lookups_multimatch(¶ms, j) < 0) + return exit_with_fail("timed_lookups_multi", + ¶ms, i, j); + + if (timed_lookups_multimatch_bulk(¶ms, j) < 0) + return exit_with_fail("timed_lookups_multi_bulk", + ¶ms, i, j); + + if (timed_deletes(¶ms, j) < 0) + return exit_with_fail("timed_deletes", ¶ms, + i, j); + + /* Print a dot to show progress on operations */ + } + printf("."); + fflush(stdout); + + perform_frees(¶ms); + } + + /* Test false positive rate using un-inserted keys */ + for (i = 0; i < NUM_KEYSIZES; i++) { + if (setup_keys_and_data(¶ms, i, 1) < 0) { + printf("Could not create keys/data/table\n"); + return -1; + } + for (j = 0; j < NUM_TYPE; j++) { + if (timed_miss_lookup(¶ms, j) < 0) + return exit_with_fail("timed_miss_lookup", + ¶ms, i, j); + } + perform_frees(¶ms); + } + + printf("\nResults (in CPU cycles/operation)\n"); + printf("-----------------------------------\n"); + printf("\n%-18s%-18s%-18s%-18s%-18s%-18s%-18s%-18s%-18s\n", + "Keysize", "type", "Add", "Lookup", "Lookup_bulk", + "lookup_multi", "lookup_multi_bulk", "Delete", + "miss_lookup"); + for (i = 0; i < NUM_KEYSIZES; i++) { + for (j = 0; j < NUM_TYPE; j++) { + printf("%-18d", hashtest_key_lens[i]); + printf("%-18d", j); + for (k = 0; k < NUM_OPERATIONS; k++) + printf("%-18"PRIu64, cycles[j][i][k]); + printf("\n"); + } + } + + printf("\nFalse results rate (and false positive rate)\n"); + printf("-----------------------------------\n"); + printf("\n%-18s%-18s%-18s%-18s%-18s%-18s%-18s\n", + "Keysize", "type", "fr_single", "fr_bulk", "fr_multi", + "fr_multi_bulk", "false_positive_rate"); + /* Key size not influence False rate so just print out one key size */ + for (i = 0; i < 1; i++) { + for (j = 0; j < NUM_TYPE; j++) { + printf("%-18d", hashtest_key_lens[i]); + printf("%-18d", j); + printf("%-18f", (float)false_data[j][i] / NUM_LOOKUPS); + printf("%-18f", (float)false_data_bulk[j][i] / + NUM_LOOKUPS); + printf("%-18f", (float)false_data_multi[j][i] / + NUM_LOOKUPS); + printf("%-18f", (float)false_data_multi_bulk[j][i] / + NUM_LOOKUPS); + printf("%-18f", (float)false_hit[j][i] / + NUM_LOOKUPS); + printf("\n"); + } + } + return 0; +} + +static int +test_member_perf(void) +{ + + if (run_all_tbl_perf_tests() < 0) + return -1; + + return 0; +} + +REGISTER_TEST_COMMAND(member_perf_autotest, test_member_perf); diff --git a/test/test/test_memcpy_perf.c b/test/test/test_memcpy_perf.c index ff3aaaac..f1084ca1 100644 --- a/test/test/test_memcpy_perf.c +++ b/test/test/test_memcpy_perf.c @@ -35,6 +35,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <sys/time.h> #include <rte_common.h> #include <rte_cycles.h> @@ -217,8 +218,9 @@ do { \ memcpy(dst+dst_addrs[t], src+src_addrs[t], size); \ total_time2 += rte_rdtsc() - start_time; \ } \ - printf("%8.0f -", (double)total_time /TEST_ITERATIONS); \ - printf("%5.0f", (double)total_time2 / TEST_ITERATIONS); \ + printf("%3.0f -", (double)total_time / TEST_ITERATIONS); \ + printf("%3.0f", (double)total_time2 / TEST_ITERATIONS); \ + printf("(%6.2f%%) ", ((double)total_time - total_time2)*100/total_time2); \ } while (0) /* Run aligned memcpy tests for each cached/uncached permutation */ @@ -300,6 +302,9 @@ static int perf_test(void) { int ret; + struct timeval tv_begin, tv_end; + double time_aligned, time_unaligned; + double time_aligned_const, time_unaligned_const; ret = init_buffers(); if (ret != 0) @@ -316,25 +321,47 @@ perf_test(void) do_uncached_write(large_buf_write, 0, small_buf_read, 1, SMALL_BUFFER_SIZE); printf("\n** rte_memcpy() - memcpy perf. tests (C = compile-time constant) **\n" - "======= ============== ============== ============== ==============\n" - " Size Cache to cache Cache to mem Mem to cache Mem to mem\n" - "(bytes) (ticks) (ticks) (ticks) (ticks)\n" - "------- -------------- -------------- -------------- --------------"); + "======= ================= ================= ================= =================\n" + " Size Cache to cache Cache to mem Mem to cache Mem to mem\n" + "(bytes) (ticks) (ticks) (ticks) (ticks)\n" + "------- ----------------- ----------------- ----------------- -----------------"); - printf("\n========================== %2dB aligned ============================", ALIGNMENT_UNIT); + printf("\n================================= %2dB aligned =================================", + ALIGNMENT_UNIT); /* Do aligned tests where size is a variable */ + gettimeofday(&tv_begin, NULL); perf_test_variable_aligned(); - printf("\n------- -------------- -------------- -------------- --------------"); + gettimeofday(&tv_end, NULL); + time_aligned = (double)(tv_end.tv_sec - tv_begin.tv_sec) + + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000; + printf("\n------- ----------------- ----------------- ----------------- -----------------"); /* Do aligned tests where size is a compile-time constant */ + gettimeofday(&tv_begin, NULL); perf_test_constant_aligned(); - printf("\n=========================== Unaligned ============================="); + gettimeofday(&tv_end, NULL); + time_aligned_const = (double)(tv_end.tv_sec - tv_begin.tv_sec) + + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000; + printf("\n================================== Unaligned =================================="); /* Do unaligned tests where size is a variable */ + gettimeofday(&tv_begin, NULL); perf_test_variable_unaligned(); - printf("\n------- -------------- -------------- -------------- --------------"); + gettimeofday(&tv_end, NULL); + time_unaligned = (double)(tv_end.tv_sec - tv_begin.tv_sec) + + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000; + printf("\n------- ----------------- ----------------- ----------------- -----------------"); /* Do unaligned tests where size is a compile-time constant */ + gettimeofday(&tv_begin, NULL); perf_test_constant_unaligned(); - printf("\n======= ============== ============== ============== ==============\n\n"); - + gettimeofday(&tv_end, NULL); + time_unaligned_const = (double)(tv_end.tv_sec - tv_begin.tv_sec) + + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000; + printf("\n======= ================= ================= ================= =================\n\n"); + + printf("Test Execution Time (seconds):\n"); + printf("Aligned variable copy size = %8.3f\n", time_aligned); + printf("Aligned constant copy size = %8.3f\n", time_aligned_const); + printf("Unaligned variable copy size = %8.3f\n", time_unaligned); + printf("Unaligned constant copy size = %8.3f\n", time_unaligned_const); free_buffers(); return 0; diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c index 0a442395..37ead503 100644 --- a/test/test/test_mempool.c +++ b/test/test/test_mempool.c @@ -44,7 +44,6 @@ #include <rte_log.h> #include <rte_debug.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_launch.h> #include <rte_cycles.h> #include <rte_eal.h> @@ -129,7 +128,7 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache) rte_mempool_dump(stdout, mp); printf("get an object\n"); - if (rte_mempool_generic_get(mp, &obj, 1, cache, 0) < 0) + if (rte_mempool_generic_get(mp, &obj, 1, cache) < 0) GOTO_ERR(ret, out); rte_mempool_dump(stdout, mp); @@ -145,28 +144,28 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache) MEMPOOL_HEADER_SIZE(mp, mp->cache_size)) GOTO_ERR(ret, out); -#ifndef RTE_EXEC_ENV_BSDAPP /* rte_mem_virt2phy() not supported on bsd */ +#ifndef RTE_EXEC_ENV_BSDAPP /* rte_mem_virt2iova() not supported on bsd */ printf("get physical address of an object\n"); - if (rte_mempool_virt2phy(mp, obj) != rte_mem_virt2phy(obj)) + if (rte_mempool_virt2iova(obj) != rte_mem_virt2iova(obj)) GOTO_ERR(ret, out); #endif printf("put the object back\n"); - rte_mempool_generic_put(mp, &obj, 1, cache, 0); + rte_mempool_generic_put(mp, &obj, 1, cache); rte_mempool_dump(stdout, mp); printf("get 2 objects\n"); - if (rte_mempool_generic_get(mp, &obj, 1, cache, 0) < 0) + if (rte_mempool_generic_get(mp, &obj, 1, cache) < 0) GOTO_ERR(ret, out); - if (rte_mempool_generic_get(mp, &obj2, 1, cache, 0) < 0) { - rte_mempool_generic_put(mp, &obj, 1, cache, 0); + if (rte_mempool_generic_get(mp, &obj2, 1, cache) < 0) { + rte_mempool_generic_put(mp, &obj, 1, cache); GOTO_ERR(ret, out); } rte_mempool_dump(stdout, mp); printf("put the objects back\n"); - rte_mempool_generic_put(mp, &obj, 1, cache, 0); - rte_mempool_generic_put(mp, &obj2, 1, cache, 0); + rte_mempool_generic_put(mp, &obj, 1, cache); + rte_mempool_generic_put(mp, &obj2, 1, cache); rte_mempool_dump(stdout, mp); /* @@ -178,7 +177,7 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache) GOTO_ERR(ret, out); for (i = 0; i < MEMPOOL_SIZE; i++) { - if (rte_mempool_generic_get(mp, &objtable[i], 1, cache, 0) < 0) + if (rte_mempool_generic_get(mp, &objtable[i], 1, cache) < 0) break; } @@ -200,7 +199,7 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache) ret = -1; } - rte_mempool_generic_put(mp, &objtable[i], 1, cache, 0); + rte_mempool_generic_put(mp, &objtable[i], 1, cache); } free(objtable); @@ -474,7 +473,7 @@ test_mempool_same_name_twice_creation(void) } /* - * BAsic test for mempool_xmem functions. + * Basic test for mempool_xmem functions. */ static int test_mempool_xmem_misc(void) @@ -485,10 +484,11 @@ test_mempool_xmem_misc(void) elt_num = MAX_KEEP; total_size = rte_mempool_calc_obj_size(MEMPOOL_ELT_SIZE, 0, NULL); - sz = rte_mempool_xmem_size(elt_num, total_size, MEMPOOL_PG_SHIFT_MAX); + sz = rte_mempool_xmem_size(elt_num, total_size, MEMPOOL_PG_SHIFT_MAX, + 0); usz = rte_mempool_xmem_usage(NULL, elt_num, total_size, 0, 1, - MEMPOOL_PG_SHIFT_MAX); + MEMPOOL_PG_SHIFT_MAX, 0); if (sz != (size_t)usz) { printf("failure @ %s: rte_mempool_xmem_usage(%u, %u) " diff --git a/test/test/test_mempool_perf.c b/test/test/test_mempool_perf.c index 07b28c06..749b364e 100644 --- a/test/test/test_mempool_perf.c +++ b/test/test/test_mempool_perf.c @@ -44,7 +44,6 @@ #include <rte_log.h> #include <rte_debug.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_launch.h> #include <rte_cycles.h> #include <rte_eal.h> @@ -186,7 +185,7 @@ per_lcore_mempool_test(void *arg) ret = rte_mempool_generic_get(mp, &obj_table[idx], n_get_bulk, - cache, 0); + cache); if (unlikely(ret < 0)) { rte_mempool_dump(stdout, mp); /* in this case, objects are lost... */ @@ -200,7 +199,7 @@ per_lcore_mempool_test(void *arg) while (idx < n_keep) { rte_mempool_generic_put(mp, &obj_table[idx], n_put_bulk, - cache, 0); + cache); idx += n_put_bulk; } } diff --git a/test/test/test_memzone.c b/test/test/test_memzone.c index 7ae31cf7..c9394c4a 100644 --- a/test/test/test_memzone.c +++ b/test/test/test_memzone.c @@ -78,7 +78,7 @@ /* Test if memory overlaps: return 1 if true, or 0 if false. */ static int -is_memory_overlap(phys_addr_t ptr1, size_t len1, phys_addr_t ptr2, size_t len2) +is_memory_overlap(rte_iova_t ptr1, size_t len1, rte_iova_t ptr2, size_t len2) { if (ptr2 >= ptr1 && (ptr2 - ptr1) < len1) return 1; @@ -510,7 +510,7 @@ test_memzone_aligned(void) printf("Unable to reserve 64-byte aligned memzone!\n"); return -1; } - if ((memzone_aligned_32->phys_addr & RTE_CACHE_LINE_MASK) != 0) + if ((memzone_aligned_32->iova & RTE_CACHE_LINE_MASK) != 0) return -1; if (((uintptr_t) memzone_aligned_32->addr & RTE_CACHE_LINE_MASK) != 0) return -1; @@ -521,7 +521,7 @@ test_memzone_aligned(void) printf("Unable to reserve 128-byte aligned memzone!\n"); return -1; } - if ((memzone_aligned_128->phys_addr & 127) != 0) + if ((memzone_aligned_128->iova & 127) != 0) return -1; if (((uintptr_t) memzone_aligned_128->addr & 127) != 0) return -1; @@ -532,7 +532,7 @@ test_memzone_aligned(void) printf("Unable to reserve 256-byte aligned memzone!\n"); return -1; } - if ((memzone_aligned_256->phys_addr & 255) != 0) + if ((memzone_aligned_256->iova & 255) != 0) return -1; if (((uintptr_t) memzone_aligned_256->addr & 255) != 0) return -1; @@ -543,7 +543,7 @@ test_memzone_aligned(void) printf("Unable to reserve 512-byte aligned memzone!\n"); return -1; } - if ((memzone_aligned_512->phys_addr & 511) != 0) + if ((memzone_aligned_512->iova & 511) != 0) return -1; if (((uintptr_t) memzone_aligned_512->addr & 511) != 0) return -1; @@ -554,7 +554,7 @@ test_memzone_aligned(void) printf("Unable to reserve 1024-byte aligned memzone!\n"); return -1; } - if ((memzone_aligned_1024->phys_addr & 1023) != 0) + if ((memzone_aligned_1024->iova & 1023) != 0) return -1; if (((uintptr_t) memzone_aligned_1024->addr & 1023) != 0) return -1; @@ -563,35 +563,35 @@ test_memzone_aligned(void) /* check that zones don't overlap */ printf("check overlapping\n"); - if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len, - memzone_aligned_128->phys_addr, memzone_aligned_128->len)) + if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len, + memzone_aligned_128->iova, memzone_aligned_128->len)) return -1; - if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len, - memzone_aligned_256->phys_addr, memzone_aligned_256->len)) + if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len, + memzone_aligned_256->iova, memzone_aligned_256->len)) return -1; - if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len, - memzone_aligned_512->phys_addr, memzone_aligned_512->len)) + if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len, + memzone_aligned_512->iova, memzone_aligned_512->len)) return -1; - if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len, - memzone_aligned_1024->phys_addr, memzone_aligned_1024->len)) + if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len, + memzone_aligned_1024->iova, memzone_aligned_1024->len)) return -1; - if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len, - memzone_aligned_256->phys_addr, memzone_aligned_256->len)) + if (is_memory_overlap(memzone_aligned_128->iova, memzone_aligned_128->len, + memzone_aligned_256->iova, memzone_aligned_256->len)) return -1; - if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len, - memzone_aligned_512->phys_addr, memzone_aligned_512->len)) + if (is_memory_overlap(memzone_aligned_128->iova, memzone_aligned_128->len, + memzone_aligned_512->iova, memzone_aligned_512->len)) return -1; - if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len, - memzone_aligned_1024->phys_addr, memzone_aligned_1024->len)) + if (is_memory_overlap(memzone_aligned_128->iova, memzone_aligned_128->len, + memzone_aligned_1024->iova, memzone_aligned_1024->len)) return -1; - if (is_memory_overlap(memzone_aligned_256->phys_addr, memzone_aligned_256->len, - memzone_aligned_512->phys_addr, memzone_aligned_512->len)) + if (is_memory_overlap(memzone_aligned_256->iova, memzone_aligned_256->len, + memzone_aligned_512->iova, memzone_aligned_512->len)) return -1; - if (is_memory_overlap(memzone_aligned_256->phys_addr, memzone_aligned_256->len, - memzone_aligned_1024->phys_addr, memzone_aligned_1024->len)) + if (is_memory_overlap(memzone_aligned_256->iova, memzone_aligned_256->len, + memzone_aligned_1024->iova, memzone_aligned_1024->len)) return -1; - if (is_memory_overlap(memzone_aligned_512->phys_addr, memzone_aligned_512->len, - memzone_aligned_1024->phys_addr, memzone_aligned_1024->len)) + if (is_memory_overlap(memzone_aligned_512->iova, memzone_aligned_512->len, + memzone_aligned_1024->iova, memzone_aligned_1024->len)) return -1; return 0; } @@ -601,9 +601,9 @@ check_memzone_bounded(const char *name, uint32_t len, uint32_t align, uint32_t bound) { const struct rte_memzone *mz; - phys_addr_t bmask; + rte_iova_t bmask; - bmask = ~((phys_addr_t)bound - 1); + bmask = ~((rte_iova_t)bound - 1); if ((mz = rte_memzone_reserve_bounded(name, len, SOCKET_ID_ANY, 0, align, bound)) == NULL) { @@ -612,7 +612,7 @@ check_memzone_bounded(const char *name, uint32_t len, uint32_t align, return -1; } - if ((mz->phys_addr & ((phys_addr_t)align - 1)) != 0) { + if ((mz->iova & ((rte_iova_t)align - 1)) != 0) { printf("%s(%s): invalid phys addr alignment\n", __func__, mz->name); return -1; @@ -631,8 +631,8 @@ check_memzone_bounded(const char *name, uint32_t len, uint32_t align, return -1; } - if ((mz->phys_addr & bmask) != - ((mz->phys_addr + mz->len - 1) & bmask)) { + if ((mz->iova & bmask) != + ((mz->iova + mz->len - 1) & bmask)) { printf("%s(%s): invalid memzone boundary %u crossed\n", __func__, mz->name, bound); return -1; @@ -787,11 +787,11 @@ test_memzone(void) /* check cache-line alignments */ printf("check alignments and lengths\n"); - if ((memzone1->phys_addr & RTE_CACHE_LINE_MASK) != 0) + if ((memzone1->iova & RTE_CACHE_LINE_MASK) != 0) return -1; - if ((memzone2->phys_addr & RTE_CACHE_LINE_MASK) != 0) + if ((memzone2->iova & RTE_CACHE_LINE_MASK) != 0) return -1; - if (memzone3 != NULL && (memzone3->phys_addr & RTE_CACHE_LINE_MASK) != 0) + if (memzone3 != NULL && (memzone3->iova & RTE_CACHE_LINE_MASK) != 0) return -1; if ((memzone1->len & RTE_CACHE_LINE_MASK) != 0 || memzone1->len == 0) return -1; @@ -806,16 +806,16 @@ test_memzone(void) /* check that zones don't overlap */ printf("check overlapping\n"); - if (is_memory_overlap(memzone1->phys_addr, memzone1->len, - memzone2->phys_addr, memzone2->len)) + if (is_memory_overlap(memzone1->iova, memzone1->len, + memzone2->iova, memzone2->len)) return -1; if (memzone3 != NULL && - is_memory_overlap(memzone1->phys_addr, memzone1->len, - memzone3->phys_addr, memzone3->len)) + is_memory_overlap(memzone1->iova, memzone1->len, + memzone3->iova, memzone3->len)) return -1; if (memzone3 != NULL && - is_memory_overlap(memzone2->phys_addr, memzone2->len, - memzone3->phys_addr, memzone3->len)) + is_memory_overlap(memzone2->iova, memzone2->len, + memzone3->iova, memzone3->len)) return -1; printf("check socket ID\n"); diff --git a/test/test/test_per_lcore.c b/test/test/test_per_lcore.c index 247e1714..4eb7fe2c 100644 --- a/test/test/test_per_lcore.c +++ b/test/test/test_per_lcore.c @@ -37,7 +37,6 @@ #include <rte_common.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_per_lcore.h> #include <rte_launch.h> #include <rte_eal.h> diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c index 1ffd65a5..255f2607 100644 --- a/test/test/test_pmd_perf.c +++ b/test/test/test_pmd_perf.c @@ -50,7 +50,7 @@ #define MAX_PKT_BURST (32) #define RTE_TEST_RX_DESC_DEFAULT (128) #define RTE_TEST_TX_DESC_DEFAULT (512) -#define RTE_PORT_ALL (~(uint8_t)0x0) +#define RTE_PORT_ALL (~(uint16_t)0x0) /* how long test would take at full line rate */ #define RTE_TEST_DURATION (2) @@ -143,7 +143,7 @@ struct lcore_conf { uint8_t status; uint8_t socketid; uint16_t nb_ports; - uint8_t portlist[RTE_MAX_ETHPORTS]; + uint16_t portlist[RTE_MAX_ETHPORTS]; } __rte_cache_aligned; struct lcore_conf lcore_conf[RTE_MAX_LCORE]; @@ -160,11 +160,12 @@ static uint32_t sc_flag; /* Check the link status of all ports in up to 3s, and print them finally */ static void -check_all_ports_link_status(uint8_t port_num, uint32_t port_mask) +check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) { #define CHECK_INTERVAL 100 /* 100ms */ #define MAX_CHECK_TIME 30 /* 3s (30 * 100ms) in total */ - uint8_t portid, count, all_ports_up, print_flag = 0; + uint16_t portid; + uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; printf("Checking link statuses...\n"); @@ -179,16 +180,15 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask) /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) { - printf("Port %d Link Up - speed %u " - "Mbps - %s\n", (uint8_t)portid, - (unsigned)link.link_speed, + printf( + "Port%d Link Up. Speed %u Mbps - %s\n", + portid, link.link_speed, (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? ("full-duplex") : ("half-duplex\n")); if (link_mbps == 0) link_mbps = link.link_speed; } else - printf("Port %d Link Down\n", - (uint8_t)portid); + printf("Port %d Link Down\n", portid); continue; } /* clear all_ports_up flag if any link down */ @@ -335,7 +335,7 @@ reset_count(void) } static void -stats_display(uint8_t port_id) +stats_display(uint16_t port_id) { struct rte_eth_stats stats; rte_eth_stats_get(port_id, &stats); @@ -383,7 +383,7 @@ measure_rxtx(struct lcore_conf *conf, while (likely(!stop)) { for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; - nb_rx = rte_eth_rx_burst((uint8_t) portid, 0, + nb_rx = rte_eth_rx_burst(portid, 0, pkts_burst, MAX_PKT_BURST); if (unlikely(nb_rx == 0)) { idle++; @@ -422,7 +422,7 @@ measure_rxonly(struct lcore_conf *conf, portid = conf->portlist[i]; cur_tsc = rte_rdtsc(); - nb_rx = rte_eth_rx_burst((uint8_t) portid, 0, + nb_rx = rte_eth_rx_burst(portid, 0, pkts_burst, MAX_PKT_BURST); if (unlikely(nb_rx == 0)) { idle++; @@ -459,7 +459,7 @@ measure_txonly(struct lcore_conf *conf, while (likely(!stop)) { for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; - nb_rx = rte_eth_rx_burst((uint8_t) portid, 0, + nb_rx = rte_eth_rx_burst(portid, 0, pkts_burst, MAX_PKT_BURST); if (unlikely(nb_rx == 0)) { idle++; @@ -537,7 +537,7 @@ main_loop(__rte_unused void *args) portid = conf->portlist[i]; int nb_free = pkt_per_port; do { /* dry out */ - nb_rx = rte_eth_rx_burst((uint8_t) portid, 0, + nb_rx = rte_eth_rx_burst(portid, 0, pkts_burst, MAX_PKT_BURST); nb_tx = 0; while (nb_tx < nb_rx) @@ -572,6 +572,7 @@ poll_burst(void *args) unsigned i, portid, nb_rx = 0; uint64_t total; uint64_t timeout = MAX_IDLE; + int num[RTE_MAX_ETHPORTS]; lcore_id = rte_lcore_id(); conf = &lcore_conf[lcore_id]; @@ -591,6 +592,7 @@ poll_burst(void *args) for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; next[portid] = i * pkt_per_port; + num[portid] = pkt_per_port; } while (!rte_atomic64_read(&start)) @@ -600,9 +602,9 @@ poll_burst(void *args) while (total) { for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; - nb_rx = rte_eth_rx_burst((uint8_t) portid, 0, - &pkts_burst[next[portid]], - MAX_PKT_BURST); + nb_rx = rte_eth_rx_burst(portid, 0, + &pkts_burst[next[portid]], + RTE_MIN(MAX_PKT_BURST, num[portid])); if (unlikely(nb_rx == 0)) { timeout--; if (unlikely(timeout == 0)) @@ -610,6 +612,7 @@ poll_burst(void *args) continue; } next[portid] += nb_rx; + num[portid] -= nb_rx; total -= nb_rx; } } @@ -618,7 +621,6 @@ timeout: printf("%"PRIu64" packets lost, IDLE %"PRIu64" times\n", total, MAX_IDLE - timeout); - /* clean up */ total = pkt_per_port * conf->nb_ports - total; for (i = 0; i < total; i++) @@ -644,7 +646,7 @@ exec_burst(uint32_t flags, int lcore) conf = &lcore_conf[lcore]; pkt_per_port = MAX_TRAFFIC_BURST; - num = pkt_per_port; + num = pkt_per_port * conf->nb_ports; rte_atomic64_init(&start); @@ -661,11 +663,12 @@ exec_burst(uint32_t flags, int lcore) nb_tx = RTE_MIN(MAX_PKT_BURST, num); for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; - rte_eth_tx_burst(portid, 0, + nb_tx = rte_eth_tx_burst(portid, 0, &tx_burst[idx], nb_tx); idx += nb_tx; + num -= nb_tx; } - num -= nb_tx; + } sleep(5); diff --git a/test/test/test_pmd_ring_perf.c b/test/test/test_pmd_ring_perf.c index 004882af..8e9cd331 100644 --- a/test/test/test_pmd_ring_perf.c +++ b/test/test/test_pmd_ring_perf.c @@ -54,7 +54,7 @@ static const volatile unsigned bulk_sizes[] = { 1, 8, 32 }; /* The ring structure used for tests */ static struct rte_ring *r; -static uint8_t ring_ethdev_port; +static uint16_t ring_ethdev_port; /* Get cycle counts for dequeuing from an empty ring. Should be 2 or 3 cycles */ static void diff --git a/test/test/test_ring.c b/test/test/test_ring.c index d664b04b..5eb40a0f 100644 --- a/test/test/test_ring.c +++ b/test/test/test_ring.c @@ -43,7 +43,6 @@ #include <rte_common.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_launch.h> #include <rte_cycles.h> #include <rte_eal.h> @@ -375,37 +374,37 @@ test_ring_burst_basic(void) printf("enqueue 1 obj\n"); ret = rte_ring_sp_enqueue_burst(r, cur_src, 1, NULL); cur_src += 1; - if ((ret & RTE_RING_SZ_MASK) != 1) + if (ret != 1) goto fail; printf("enqueue 2 objs\n"); ret = rte_ring_sp_enqueue_burst(r, cur_src, 2, NULL); cur_src += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; printf("enqueue MAX_BULK objs\n"); ret = rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL); cur_src += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) + if (ret != MAX_BULK) goto fail; printf("dequeue 1 obj\n"); ret = rte_ring_sc_dequeue_burst(r, cur_dst, 1, NULL); cur_dst += 1; - if ((ret & RTE_RING_SZ_MASK) != 1) + if (ret != 1) goto fail; printf("dequeue 2 objs\n"); ret = rte_ring_sc_dequeue_burst(r, cur_dst, 2, NULL); cur_dst += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; printf("dequeue MAX_BULK objs\n"); ret = rte_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); cur_dst += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) + if (ret != MAX_BULK) goto fail; /* check data */ @@ -423,22 +422,21 @@ test_ring_burst_basic(void) for (i = 0; i< (RING_SIZE/MAX_BULK - 1); i++) { ret = rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL); cur_src += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) { + if (ret != MAX_BULK) goto fail; - } } printf("Enqueue 2 objects, free entries = MAX_BULK - 2 \n"); ret = rte_ring_sp_enqueue_burst(r, cur_src, 2, NULL); cur_src += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; printf("Enqueue the remaining entries = MAX_BULK - 2 \n"); /* Always one free entry left */ ret = rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL); cur_src += MAX_BULK - 3; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK - 3) + if (ret != MAX_BULK - 3) goto fail; printf("Test if ring is full \n"); @@ -447,26 +445,26 @@ test_ring_burst_basic(void) printf("Test enqueue for a full entry \n"); ret = rte_ring_sp_enqueue_burst(r, cur_src, MAX_BULK, NULL); - if ((ret & RTE_RING_SZ_MASK) != 0) + if (ret != 0) goto fail; printf("Test dequeue without enough objects \n"); for (i = 0; i<RING_SIZE/MAX_BULK - 1; i++) { ret = rte_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); cur_dst += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) + if (ret != MAX_BULK) goto fail; } /* Available memory space for the exact MAX_BULK entries */ ret = rte_ring_sc_dequeue_burst(r, cur_dst, 2, NULL); cur_dst += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; ret = rte_ring_sc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); cur_dst += MAX_BULK - 3; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK - 3) + if (ret != MAX_BULK - 3) goto fail; printf("Test if ring is empty \n"); @@ -490,37 +488,37 @@ test_ring_burst_basic(void) printf("enqueue 1 obj\n"); ret = rte_ring_mp_enqueue_burst(r, cur_src, 1, NULL); cur_src += 1; - if ((ret & RTE_RING_SZ_MASK) != 1) + if (ret != 1) goto fail; printf("enqueue 2 objs\n"); ret = rte_ring_mp_enqueue_burst(r, cur_src, 2, NULL); cur_src += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; printf("enqueue MAX_BULK objs\n"); ret = rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, NULL); cur_src += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) + if (ret != MAX_BULK) goto fail; printf("dequeue 1 obj\n"); ret = rte_ring_mc_dequeue_burst(r, cur_dst, 1, NULL); cur_dst += 1; - if ((ret & RTE_RING_SZ_MASK) != 1) + if (ret != 1) goto fail; printf("dequeue 2 objs\n"); ret = rte_ring_mc_dequeue_burst(r, cur_dst, 2, NULL); cur_dst += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; printf("dequeue MAX_BULK objs\n"); ret = rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); cur_dst += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) + if (ret != MAX_BULK) goto fail; /* check data */ @@ -538,11 +536,11 @@ test_ring_burst_basic(void) for (i = 0; i<RING_SIZE/MAX_BULK; i++) { ret = rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, NULL); cur_src += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) + if (ret != MAX_BULK) goto fail; ret = rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); cur_dst += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) + if (ret != MAX_BULK) goto fail; } @@ -561,19 +559,19 @@ test_ring_burst_basic(void) for (i = 0; i<RING_SIZE/MAX_BULK - 1; i++) { ret = rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, NULL); cur_src += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) + if (ret != MAX_BULK) goto fail; } /* Available memory space for the exact MAX_BULK objects */ ret = rte_ring_mp_enqueue_burst(r, cur_src, 2, NULL); cur_src += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; ret = rte_ring_mp_enqueue_burst(r, cur_src, MAX_BULK, NULL); cur_src += MAX_BULK - 3; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK - 3) + if (ret != MAX_BULK - 3) goto fail; @@ -581,19 +579,19 @@ test_ring_burst_basic(void) for (i = 0; i<RING_SIZE/MAX_BULK - 1; i++) { ret = rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); cur_dst += MAX_BULK; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK) + if (ret != MAX_BULK) goto fail; } /* Available objects - the exact MAX_BULK */ ret = rte_ring_mc_dequeue_burst(r, cur_dst, 2, NULL); cur_dst += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; ret = rte_ring_mc_dequeue_burst(r, cur_dst, MAX_BULK, NULL); cur_dst += MAX_BULK - 3; - if ((ret & RTE_RING_SZ_MASK) != MAX_BULK - 3) + if (ret != MAX_BULK - 3) goto fail; /* check data */ @@ -611,7 +609,7 @@ test_ring_burst_basic(void) ret = rte_ring_enqueue_burst(r, cur_src, 2, NULL); cur_src += 2; - if ((ret & RTE_RING_SZ_MASK) != 2) + if (ret != 2) goto fail; ret = rte_ring_dequeue_burst(r, cur_dst, 2, NULL); @@ -749,7 +747,7 @@ test_ring_basic_ex(void) /* Covering the ring burst operation */ ret = rte_ring_enqueue_burst(rp, obj, 2, NULL); - if ((ret & RTE_RING_SZ_MASK) != 2) { + if (ret != 2) { printf("test_ring_basic_ex: rte_ring_enqueue_burst fails \n"); goto fail_test; } diff --git a/test/test/test_rwlock.c b/test/test/test_rwlock.c index 3dd2ed4c..08685d32 100644 --- a/test/test/test_rwlock.c +++ b/test/test/test_rwlock.c @@ -38,7 +38,6 @@ #include <rte_common.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_per_lcore.h> #include <rte_launch.h> #include <rte_atomic.h> diff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c index 88fac8f4..311c704e 100644 --- a/test/test/test_service_cores.c +++ b/test/test/test_service_cores.c @@ -131,17 +131,13 @@ static int unregister_all(void) { uint32_t i; - struct rte_service_spec *dead = (struct rte_service_spec *)0xdead; - TEST_ASSERT_EQUAL(-EINVAL, rte_service_unregister(0), - "Unregistered NULL pointer"); - TEST_ASSERT_EQUAL(-EINVAL, rte_service_unregister(dead), - "Unregistered invalid pointer"); + TEST_ASSERT_EQUAL(-EINVAL, rte_service_component_unregister(1000), + "Unregistered invalid service id"); uint32_t c = rte_service_get_count(); for (i = 0; i < c; i++) { - struct rte_service_spec *s = rte_service_get_by_id(i); - TEST_ASSERT_EQUAL(0, rte_service_unregister(s), + TEST_ASSERT_EQUAL(0, rte_service_component_unregister(i), "Error unregistering a valid service"); } @@ -160,17 +156,22 @@ dummy_register(void) struct rte_service_spec service; memset(&service, 0, sizeof(struct rte_service_spec)); - TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service), + TEST_ASSERT_EQUAL(-EINVAL, + rte_service_component_register(&service, NULL), "Invalid callback"); service.callback = dummy_cb; - TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service), + TEST_ASSERT_EQUAL(-EINVAL, + rte_service_component_register(&service, NULL), "Invalid name"); snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME); - TEST_ASSERT_EQUAL(0, rte_service_register(&service), + uint32_t id; + TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, &id), "Failed to register valid service"); + rte_service_component_runstate_set(id, 1); + return TEST_SUCCESS; } @@ -180,32 +181,41 @@ service_get_by_name(void) { unregister_all(); - /* ensure with no services registered returns NULL */ - TEST_ASSERT_EQUAL(0, rte_service_get_by_name(DUMMY_SERVICE_NAME), - "Service get by name should return NULL"); + uint32_t sid; + TEST_ASSERT_EQUAL(-ENODEV, + rte_service_get_by_name(DUMMY_SERVICE_NAME, &sid), + "get by name with invalid name should return -ENODEV"); + TEST_ASSERT_EQUAL(-EINVAL, + rte_service_get_by_name(DUMMY_SERVICE_NAME, 0x0), + "get by name with NULL ptr should return -ENODEV"); /* register service */ struct rte_service_spec service; memset(&service, 0, sizeof(struct rte_service_spec)); - TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service), + TEST_ASSERT_EQUAL(-EINVAL, + rte_service_component_register(&service, NULL), "Invalid callback"); service.callback = dummy_cb; - TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service), + TEST_ASSERT_EQUAL(-EINVAL, + rte_service_component_register(&service, NULL), "Invalid name"); snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME); - TEST_ASSERT_EQUAL(0, rte_service_register(&service), + TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, NULL), "Failed to register valid service"); - /* ensure with dummy services registered returns same ptr as ID */ - struct rte_service_spec *s_by_id = rte_service_get_by_id(0); - TEST_ASSERT_EQUAL(s_by_id, rte_service_get_by_name(DUMMY_SERVICE_NAME), - "Service get_by_name should equal get_by_id()"); + /* we unregistered all service, now registering 1, should be id 0 */ + uint32_t service_id_as_expected = 0; + TEST_ASSERT_EQUAL(0, rte_service_get_by_name(DUMMY_SERVICE_NAME, &sid), + "Service get_by_name should return 0 on valid inputs"); + TEST_ASSERT_EQUAL(service_id_as_expected, sid, + "Service get_by_name should equal expected id"); unregister_all(); /* ensure after unregister, get_by_name returns NULL */ - TEST_ASSERT_EQUAL(0, rte_service_get_by_name(DUMMY_SERVICE_NAME), - "get by name should return NULL after unregister"); + TEST_ASSERT_EQUAL(-ENODEV, + rte_service_get_by_name(DUMMY_SERVICE_NAME, &sid), + "get by name should return -ENODEV after unregister"); return TEST_SUCCESS; } @@ -221,12 +231,12 @@ service_probe_capability(void) service.callback = dummy_cb; snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME); service.capabilities |= RTE_SERVICE_CAP_MT_SAFE; - TEST_ASSERT_EQUAL(0, rte_service_register(&service), + TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, NULL), "Register of MT SAFE service failed"); /* verify flag is enabled */ - struct rte_service_spec *s = rte_service_get_by_id(0); - int32_t mt = rte_service_probe_capability(s, RTE_SERVICE_CAP_MT_SAFE); + const uint32_t sid = 0; + int32_t mt = rte_service_probe_capability(sid, RTE_SERVICE_CAP_MT_SAFE); TEST_ASSERT_EQUAL(1, mt, "MT SAFE capability flag not set."); @@ -235,12 +245,11 @@ service_probe_capability(void) memset(&service, 0, sizeof(struct rte_service_spec)); service.callback = dummy_cb; snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME); - TEST_ASSERT_EQUAL(0, rte_service_register(&service), + TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, NULL), "Register of non-MT safe service failed"); /* verify flag is enabled */ - s = rte_service_get_by_id(0); - mt = rte_service_probe_capability(s, RTE_SERVICE_CAP_MT_SAFE); + mt = rte_service_probe_capability(sid, RTE_SERVICE_CAP_MT_SAFE); TEST_ASSERT_EQUAL(0, mt, "MT SAFE cap flag set on non MT SAFE service"); return unregister_all(); @@ -250,9 +259,8 @@ service_probe_capability(void) static int service_name(void) { - struct rte_service_spec *service = rte_service_get_by_id(0); - - int equal = strcmp(service->name, DUMMY_SERVICE_NAME); + const char *name = rte_service_get_name(0); + int equal = strcmp(name, DUMMY_SERVICE_NAME); TEST_ASSERT_EQUAL(0, equal, "Error: Service name not correct"); return unregister_all(); @@ -262,11 +270,11 @@ service_name(void) static int service_dump(void) { - struct rte_service_spec *service = rte_service_get_by_id(0); - rte_service_set_stats_enable(service, 1); - rte_service_dump(stdout, service); - rte_service_set_stats_enable(service, 0); - rte_service_dump(stdout, service); + const uint32_t sid = 0; + rte_service_set_stats_enable(sid, 1); + rte_service_dump(stdout, 0); + rte_service_set_stats_enable(sid, 0); + rte_service_dump(stdout, 0); return unregister_all(); } @@ -274,28 +282,28 @@ service_dump(void) static int service_start_stop(void) { - struct rte_service_spec *service = rte_service_get_by_id(0); + const uint32_t sid = 0; - /* is_running() returns if service is running and slcore is mapped */ + /* runstate_get() returns if service is running and slcore is mapped */ TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id), "Service core add did not return zero"); - int ret = rte_service_enable_on_lcore(service, slcore_id); + int ret = rte_service_map_lcore_set(sid, slcore_id, 1); TEST_ASSERT_EQUAL(0, ret, "Enabling service core, expected 0 got %d", ret); - TEST_ASSERT_EQUAL(0, rte_service_is_running(service), + TEST_ASSERT_EQUAL(0, rte_service_runstate_get(sid), "Error: Service should be stopped"); - TEST_ASSERT_EQUAL(0, rte_service_stop(service), + TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 0), "Error: Service stopped returned non-zero"); - TEST_ASSERT_EQUAL(0, rte_service_is_running(service), + TEST_ASSERT_EQUAL(0, rte_service_runstate_get(sid), "Error: Service is running - should be stopped"); - TEST_ASSERT_EQUAL(0, rte_service_start(service), + TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 1), "Error: Service start returned non-zero"); - TEST_ASSERT_EQUAL(1, rte_service_is_running(service), + TEST_ASSERT_EQUAL(1, rte_service_runstate_get(sid), "Error: Service is not running"); return unregister_all(); @@ -314,12 +322,12 @@ service_remote_launch_func(void *arg) static int service_lcore_en_dis_able(void) { - struct rte_service_spec *s = rte_service_get_by_id(0); + const uint32_t sid = 0; /* expected failure cases */ - TEST_ASSERT_EQUAL(-EINVAL, rte_service_enable_on_lcore(s, 100000), + TEST_ASSERT_EQUAL(-EINVAL, rte_service_map_lcore_set(sid, 100000, 1), "Enable on invalid core did not fail"); - TEST_ASSERT_EQUAL(-EINVAL, rte_service_disable_on_lcore(s, 100000), + TEST_ASSERT_EQUAL(-EINVAL, rte_service_map_lcore_set(sid, 100000, 0), "Disable on invalid core did not fail"); /* add service core to allow enabling */ @@ -327,15 +335,15 @@ service_lcore_en_dis_able(void) "Add service core failed when not in use before"); /* valid enable */ - TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_id), + TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_id, 1), "Enabling valid service and core failed"); - TEST_ASSERT_EQUAL(1, rte_service_get_enabled_on_lcore(s, slcore_id), + TEST_ASSERT_EQUAL(1, rte_service_map_lcore_get(sid, slcore_id), "Enabled core returned not-enabled"); /* valid disable */ - TEST_ASSERT_EQUAL(0, rte_service_disable_on_lcore(s, slcore_id), + TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_id, 0), "Disabling valid service and lcore failed"); - TEST_ASSERT_EQUAL(0, rte_service_get_enabled_on_lcore(s, slcore_id), + TEST_ASSERT_EQUAL(0, rte_service_map_lcore_get(sid, slcore_id), "Disabled core returned enabled"); /* call remote_launch to verify that app can launch ex-service lcore */ @@ -465,21 +473,19 @@ service_threaded_test(int mt_safe) if (mt_safe) { service.callback = dummy_mt_safe_cb; service.capabilities |= RTE_SERVICE_CAP_MT_SAFE; - } else { - /* initialize to pass, see callback comment for details */ - test_params[1] = 1; + } else service.callback = dummy_mt_unsafe_cb; - } - TEST_ASSERT_EQUAL(0, rte_service_register(&service), + uint32_t id; + TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, &id), "Register of MT SAFE service failed"); - struct rte_service_spec *s = rte_service_get_by_id(0); - TEST_ASSERT_EQUAL(0, rte_service_start(s), + const uint32_t sid = 0; + TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 1), "Starting valid service failed"); - TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_1), + TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_1, 1), "Failed to enable lcore 1 on mt safe service"); - TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_2), + TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_2, 1), "Failed to enable lcore 2 on mt safe service"); rte_service_lcore_start(slcore_1); rte_service_lcore_start(slcore_2); @@ -489,10 +495,27 @@ service_threaded_test(int mt_safe) rte_service_lcore_stop(slcore_1); rte_service_lcore_stop(slcore_2); + TEST_ASSERT_EQUAL(0, test_params[1], + "Service run with component runstate = 0"); + + /* enable backend runstate: the service should run after this */ + rte_service_component_runstate_set(id, 1); + + /* initialize to pass, see callback comment for details */ + if (!mt_safe) + test_params[1] = 1; + + rte_service_lcore_start(slcore_1); + rte_service_lcore_start(slcore_2); + + /* wait for the worker threads to run */ + rte_delay_ms(500); + rte_service_lcore_stop(slcore_1); + rte_service_lcore_stop(slcore_2); + TEST_ASSERT_EQUAL(1, test_params[1], "MT Safe service not run by two cores concurrently"); - - TEST_ASSERT_EQUAL(0, rte_service_stop(s), + TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 0), "Failed to stop MT Safe service"); unregister_all(); @@ -525,15 +548,122 @@ service_mt_unsafe_poll(void) return TEST_SUCCESS; } +static int32_t +delay_as_a_mt_safe_service(void *args) +{ + RTE_SET_USED(args); + uint32_t *params = args; + + /* retrieve done flag and atomic lock to inc/dec */ + uint32_t *done = ¶ms[0]; + rte_atomic32_t *lock = (rte_atomic32_t *)¶ms[1]; + + while (!*done) { + rte_atomic32_inc(lock); + rte_delay_us(500); + if (rte_atomic32_read(lock) > 1) + /* pass: second core has simultaneously incremented */ + *done = 1; + rte_atomic32_dec(lock); + } + + return 0; +} + +static int32_t +delay_as_a_service(void *args) +{ + uint32_t *done = (uint32_t *)args; + while (!*done) + rte_delay_ms(5); + return 0; +} + +static int +service_run_on_app_core_func(void *arg) +{ + uint32_t *delay_service_id = (uint32_t *)arg; + return rte_service_run_iter_on_app_lcore(*delay_service_id, 1); +} + +static int +service_app_lcore_poll_impl(const int mt_safe) +{ + uint32_t params[2] = {0}; + + struct rte_service_spec service; + memset(&service, 0, sizeof(struct rte_service_spec)); + snprintf(service.name, sizeof(service.name), MT_SAFE_SERVICE_NAME); + if (mt_safe) { + service.callback = delay_as_a_mt_safe_service; + service.callback_userdata = params; + service.capabilities |= RTE_SERVICE_CAP_MT_SAFE; + } else { + service.callback = delay_as_a_service; + service.callback_userdata = ¶ms; + } + + uint32_t id; + TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, &id), + "Register of app lcore delay service failed"); + + rte_service_component_runstate_set(id, 1); + rte_service_runstate_set(id, 1); + + uint32_t app_core2 = rte_get_next_lcore(slcore_id, 1, 1); + int app_core2_ret = rte_eal_remote_launch(service_run_on_app_core_func, + &id, app_core2); + + rte_delay_ms(100); + + int app_core1_ret = service_run_on_app_core_func(&id); + + /* flag done, then wait for the spawned 2nd core to return */ + params[0] = 1; + rte_eal_mp_wait_lcore(); + + /* core two gets launched first - and should hold the service lock */ + TEST_ASSERT_EQUAL(0, app_core2_ret, + "App core2 : run service didn't return zero"); + + if (mt_safe) { + /* mt safe should have both cores return 0 for success */ + TEST_ASSERT_EQUAL(0, app_core1_ret, + "MT Safe: App core1 didn't return 0"); + } else { + /* core one attempts to run later - should be blocked */ + TEST_ASSERT_EQUAL(-EBUSY, app_core1_ret, + "MT Unsafe: App core1 didn't return -EBUSY"); + } + + unregister_all(); + + return TEST_SUCCESS; +} + +static int +service_app_lcore_mt_safe(void) +{ + const int mt_safe = 1; + return service_app_lcore_poll_impl(mt_safe); +} + +static int +service_app_lcore_mt_unsafe(void) +{ + const int mt_safe = 0; + return service_app_lcore_poll_impl(mt_safe); +} + /* start and stop a service core - ensuring it goes back to sleep */ static int service_lcore_start_stop(void) { /* start service core and service, create mapping so tick() runs */ - struct rte_service_spec *s = rte_service_get_by_id(0); - TEST_ASSERT_EQUAL(0, rte_service_start(s), + const uint32_t sid = 0; + TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 1), "Starting valid service failed"); - TEST_ASSERT_EQUAL(-EINVAL, rte_service_enable_on_lcore(s, slcore_id), + TEST_ASSERT_EQUAL(-EINVAL, rte_service_map_lcore_set(sid, slcore_id, 1), "Enabling valid service on non-service core must fail"); /* core start */ @@ -541,7 +671,7 @@ service_lcore_start_stop(void) "Service core start without add should return EINVAL"); TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id), "Service core add did not return zero"); - TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_id), + TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_id, 1), "Enabling valid service on valid core failed"); TEST_ASSERT_EQUAL(0, rte_service_lcore_start(slcore_id), "Service core start after add failed"); @@ -553,6 +683,10 @@ service_lcore_start_stop(void) "Service core expected to poll service but it didn't"); /* core stop */ + TEST_ASSERT_EQUAL(-EBUSY, rte_service_lcore_stop(slcore_id), + "Service core running a service should return -EBUSY"); + TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 0), + "Stopping valid service failed"); TEST_ASSERT_EQUAL(-EINVAL, rte_service_lcore_stop(100000), "Invalid Service core stop should return -EINVAL"); TEST_ASSERT_EQUAL(0, rte_service_lcore_stop(slcore_id), @@ -586,6 +720,8 @@ static struct unit_test_suite service_tests = { TEST_CASE_ST(dummy_register, NULL, service_lcore_en_dis_able), TEST_CASE_ST(dummy_register, NULL, service_mt_unsafe_poll), TEST_CASE_ST(dummy_register, NULL, service_mt_safe_poll), + TEST_CASE_ST(dummy_register, NULL, service_app_lcore_mt_safe), + TEST_CASE_ST(dummy_register, NULL, service_app_lcore_mt_unsafe), TEST_CASES_END() /**< NULL terminate unit test array */ } }; diff --git a/test/test/test_spinlock.c b/test/test/test_spinlock.c index a93f1baa..bb34e0c6 100644 --- a/test/test/test_spinlock.c +++ b/test/test/test_spinlock.c @@ -40,7 +40,6 @@ #include <rte_common.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_per_lcore.h> #include <rte_launch.h> #include <rte_eal.h> diff --git a/test/test/test_table.c b/test/test/test_table.c index 9e9eed88..db7d4e66 100644 --- a/test/test/test_table.c +++ b/test/test/test_table.c @@ -72,6 +72,7 @@ static void app_init_rings(void); static void app_init_mbuf_pools(void); uint64_t pipeline_test_hash(void *key, + __attribute__((unused)) void *key_mask, __attribute__((unused)) uint32_t key_size, __attribute__((unused)) uint64_t seed) { diff --git a/test/test/test_table.h b/test/test/test_table.h index 84d1845a..8c1df333 100644 --- a/test/test/test_table.h +++ b/test/test/test_table.h @@ -94,7 +94,7 @@ APP_METADATA_OFFSET(32)); \ k32 = (uint32_t *) key; \ k32[0] = (value); \ - *signature = pipeline_test_hash(key, 0, 0); \ + *signature = pipeline_test_hash(key, NULL, 0, 0); \ rte_ring_enqueue((ring), m); \ } while (0) @@ -131,6 +131,7 @@ /* Function definitions */ uint64_t pipeline_test_hash( void *key, + __attribute__((unused)) void *key_mask, __attribute__((unused)) uint32_t key_size, __attribute__((unused)) uint64_t seed); diff --git a/test/test/test_table_combined.c b/test/test/test_table_combined.c index a2d19a1a..e8637884 100644 --- a/test/test/test_table_combined.c +++ b/test/test/test_table_combined.c @@ -441,12 +441,15 @@ test_table_hash8lru(void) int status, i; /* Traffic flow */ - struct rte_table_hash_key8_lru_params key8lru_params = { - .n_entries = 1<<24, - .f_hash = pipeline_test_hash, - .signature_offset = APP_METADATA_OFFSET(0), + struct rte_table_hash_params key8lru_params = { + .name = "TABLE", + .key_size = 8, .key_offset = APP_METADATA_OFFSET(32), .key_mask = NULL, + .n_keys = 1 << 16, + .n_buckets = 1 << 16, + .f_hash = pipeline_test_hash, + .seed = 0, }; uint8_t key8lru[8]; @@ -475,14 +478,14 @@ test_table_hash8lru(void) VERIFY(status, CHECK_TABLE_OK); /* Invalid parameters */ - key8lru_params.n_entries = 0; + key8lru_params.n_keys = 0; status = test_table_type(&rte_table_hash_key8_lru_ops, (void *)&key8lru_params, (void *)key8lru, &table_packets, NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - key8lru_params.n_entries = 1<<16; + key8lru_params.n_keys = 1<<16; key8lru_params.f_hash = NULL; status = test_table_type(&rte_table_hash_key8_lru_ops, @@ -499,13 +502,15 @@ test_table_hash16lru(void) int status, i; /* Traffic flow */ - struct rte_table_hash_key16_lru_params key16lru_params = { - .n_entries = 1<<16, - .f_hash = pipeline_test_hash, - .seed = 0, - .signature_offset = APP_METADATA_OFFSET(0), + struct rte_table_hash_params key16lru_params = { + .name = "TABLE", + .key_size = 16, .key_offset = APP_METADATA_OFFSET(32), .key_mask = NULL, + .n_keys = 1 << 16, + .n_buckets = 1 << 16, + .f_hash = pipeline_test_hash, + .seed = 0, }; uint8_t key16lru[16]; @@ -534,14 +539,14 @@ test_table_hash16lru(void) VERIFY(status, CHECK_TABLE_OK); /* Invalid parameters */ - key16lru_params.n_entries = 0; + key16lru_params.n_keys = 0; status = test_table_type(&rte_table_hash_key16_lru_ops, (void *)&key16lru_params, (void *)key16lru, &table_packets, NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - key16lru_params.n_entries = 1<<16; + key16lru_params.n_keys = 1<<16; key16lru_params.f_hash = NULL; status = test_table_type(&rte_table_hash_key16_lru_ops, @@ -558,12 +563,15 @@ test_table_hash32lru(void) int status, i; /* Traffic flow */ - struct rte_table_hash_key32_lru_params key32lru_params = { - .n_entries = 1<<16, + struct rte_table_hash_params key32lru_params = { + .name = "TABLE", + .key_size = 32, + .key_offset = APP_METADATA_OFFSET(32), + .key_mask = NULL, + .n_keys = 1 << 16, + .n_buckets = 1 << 16, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key32lru[32]; @@ -592,14 +600,14 @@ test_table_hash32lru(void) VERIFY(status, CHECK_TABLE_OK); /* Invalid parameters */ - key32lru_params.n_entries = 0; + key32lru_params.n_keys = 0; status = test_table_type(&rte_table_hash_key32_lru_ops, (void *)&key32lru_params, (void *)key32lru, &table_packets, NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - key32lru_params.n_entries = 1<<16; + key32lru_params.n_keys = 1<<16; key32lru_params.f_hash = NULL; status = test_table_type(&rte_table_hash_key32_lru_ops, @@ -616,14 +624,15 @@ test_table_hash8ext(void) int status, i; /* Traffic flow */ - struct rte_table_hash_key8_ext_params key8ext_params = { - .n_entries = 1<<16, - .n_entries_ext = 1<<15, - .f_hash = pipeline_test_hash, - .seed = 0, - .signature_offset = APP_METADATA_OFFSET(0), + struct rte_table_hash_params key8ext_params = { + .name = "TABLE", + .key_size = 8, .key_offset = APP_METADATA_OFFSET(32), .key_mask = NULL, + .n_keys = 1 << 16, + .n_buckets = 1 << 16, + .f_hash = pipeline_test_hash, + .seed = 0, }; uint8_t key8ext[8]; @@ -652,14 +661,14 @@ test_table_hash8ext(void) VERIFY(status, CHECK_TABLE_OK); /* Invalid parameters */ - key8ext_params.n_entries = 0; + key8ext_params.n_keys = 0; status = test_table_type(&rte_table_hash_key8_ext_ops, (void *)&key8ext_params, (void *)key8ext, &table_packets, NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - key8ext_params.n_entries = 1<<16; + key8ext_params.n_keys = 1<<16; key8ext_params.f_hash = NULL; status = test_table_type(&rte_table_hash_key8_ext_ops, @@ -667,13 +676,6 @@ test_table_hash8ext(void) NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - key8ext_params.f_hash = pipeline_test_hash; - key8ext_params.n_entries_ext = 0; - - status = test_table_type(&rte_table_hash_key8_ext_ops, - (void *)&key8ext_params, (void *)key8ext, &table_packets, NULL, 0); - VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - return 0; } @@ -683,14 +685,15 @@ test_table_hash16ext(void) int status, i; /* Traffic flow */ - struct rte_table_hash_key16_ext_params key16ext_params = { - .n_entries = 1<<16, - .n_entries_ext = 1<<15, - .f_hash = pipeline_test_hash, - .seed = 0, - .signature_offset = APP_METADATA_OFFSET(0), + struct rte_table_hash_params key16ext_params = { + .name = "TABLE", + .key_size = 16, .key_offset = APP_METADATA_OFFSET(32), .key_mask = NULL, + .n_keys = 1 << 16, + .n_buckets = 1 << 16, + .f_hash = pipeline_test_hash, + .seed = 0, }; uint8_t key16ext[16]; @@ -719,14 +722,14 @@ test_table_hash16ext(void) VERIFY(status, CHECK_TABLE_OK); /* Invalid parameters */ - key16ext_params.n_entries = 0; + key16ext_params.n_keys = 0; status = test_table_type(&rte_table_hash_key16_ext_ops, (void *)&key16ext_params, (void *)key16ext, &table_packets, NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - key16ext_params.n_entries = 1<<16; + key16ext_params.n_keys = 1<<16; key16ext_params.f_hash = NULL; status = test_table_type(&rte_table_hash_key16_ext_ops, @@ -734,13 +737,6 @@ test_table_hash16ext(void) NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - key16ext_params.f_hash = pipeline_test_hash; - key16ext_params.n_entries_ext = 0; - - status = test_table_type(&rte_table_hash_key16_ext_ops, - (void *)&key16ext_params, (void *)key16ext, &table_packets, NULL, 0); - VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - return 0; } @@ -750,13 +746,15 @@ test_table_hash32ext(void) int status, i; /* Traffic flow */ - struct rte_table_hash_key32_ext_params key32ext_params = { - .n_entries = 1<<16, - .n_entries_ext = 1<<15, + struct rte_table_hash_params key32ext_params = { + .name = "TABLE", + .key_size = 32, + .key_offset = APP_METADATA_OFFSET(32), + .key_mask = NULL, + .n_keys = 1 << 16, + .n_buckets = 1 << 16, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key32ext[32]; @@ -785,14 +783,14 @@ test_table_hash32ext(void) VERIFY(status, CHECK_TABLE_OK); /* Invalid parameters */ - key32ext_params.n_entries = 0; + key32ext_params.n_keys = 0; status = test_table_type(&rte_table_hash_key32_ext_ops, (void *)&key32ext_params, (void *)key32ext, &table_packets, NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - key32ext_params.n_entries = 1<<16; + key32ext_params.n_keys = 1<<16; key32ext_params.f_hash = NULL; status = test_table_type(&rte_table_hash_key32_ext_ops, @@ -800,14 +798,6 @@ test_table_hash32ext(void) NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - key32ext_params.f_hash = pipeline_test_hash; - key32ext_params.n_entries_ext = 0; - - status = test_table_type(&rte_table_hash_key32_ext_ops, - (void *)&key32ext_params, (void *)key32ext, &table_packets, - NULL, 0); - VERIFY(status, CHECK_TABLE_TABLE_CONFIG); - return 0; } @@ -817,14 +807,15 @@ test_table_hash_cuckoo_combined(void) int status, i; /* Traffic flow */ - struct rte_table_hash_cuckoo_params cuckoo_params = { + struct rte_table_hash_params cuckoo_params = { + .name = "TABLE", .key_size = 32, - .n_keys = 1<<16, + .key_offset = APP_METADATA_OFFSET(32), + .key_mask = NULL, + .n_keys = 1 << 16, + .n_buckets = 1 << 16, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = APP_METADATA_OFFSET(0), - .key_offset = APP_METADATA_OFFSET(32), - .name = "CUCKOO_HASH", }; uint8_t key_cuckoo[32]; @@ -847,7 +838,7 @@ test_table_hash_cuckoo_combined(void) table_packets.n_hit_packets = 50; table_packets.n_miss_packets = 50; - status = test_table_type(&rte_table_hash_cuckoo_dosig_ops, + status = test_table_type(&rte_table_hash_cuckoo_ops, (void *)&cuckoo_params, (void *)key_cuckoo, &table_packets, NULL, 0); VERIFY(status, CHECK_TABLE_OK); @@ -855,7 +846,7 @@ test_table_hash_cuckoo_combined(void) /* Invalid parameters */ cuckoo_params.key_size = 0; - status = test_table_type(&rte_table_hash_cuckoo_dosig_ops, + status = test_table_type(&rte_table_hash_cuckoo_ops, (void *)&cuckoo_params, (void *)key_cuckoo, &table_packets, NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); @@ -863,7 +854,7 @@ test_table_hash_cuckoo_combined(void) cuckoo_params.key_size = 32; cuckoo_params.n_keys = 0; - status = test_table_type(&rte_table_hash_cuckoo_dosig_ops, + status = test_table_type(&rte_table_hash_cuckoo_ops, (void *)&cuckoo_params, (void *)key_cuckoo, &table_packets, NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); @@ -871,7 +862,7 @@ test_table_hash_cuckoo_combined(void) cuckoo_params.n_keys = 1<<16; cuckoo_params.f_hash = NULL; - status = test_table_type(&rte_table_hash_cuckoo_dosig_ops, + status = test_table_type(&rte_table_hash_cuckoo_ops, (void *)&cuckoo_params, (void *)key_cuckoo, &table_packets, NULL, 0); VERIFY(status, CHECK_TABLE_TABLE_CONFIG); diff --git a/test/test/test_table_tables.c b/test/test/test_table_tables.c index d835eb9f..a1b0c582 100644 --- a/test/test/test_table_tables.c +++ b/test/test/test_table_tables.c @@ -60,16 +60,16 @@ table_test table_tests[] = { memset(key, 0, 32); \ k32 = (uint32_t *) key; \ k32[0] = (value); \ - *signature = pipeline_test_hash(key, 0, 0); \ + *signature = pipeline_test_hash(key, NULL, 0, 0); \ } while (0) unsigned n_table_tests = RTE_DIM(table_tests); /* Function prototypes */ static int -test_table_hash_lru_generic(struct rte_table_ops *ops); +test_table_hash_lru_generic(struct rte_table_ops *ops, uint32_t key_size); static int -test_table_hash_ext_generic(struct rte_table_ops *ops); +test_table_hash_ext_generic(struct rte_table_ops *ops, uint32_t key_size); struct rte_bucket_4_8 { /* Cache line 0 */ @@ -655,7 +655,7 @@ test_table_lpm_ipv6(void) } static int -test_table_hash_lru_generic(struct rte_table_ops *ops) +test_table_hash_lru_generic(struct rte_table_ops *ops, uint32_t key_size) { int status, i; uint64_t expected_mask = 0, result_mask; @@ -667,36 +667,24 @@ test_table_hash_lru_generic(struct rte_table_ops *ops) int key_found; /* Initialize params and create tables */ - struct rte_table_hash_key8_lru_params hash_params = { - .n_entries = 1 << 10, - .f_hash = pipeline_test_hash, - .seed = 0, - .signature_offset = APP_METADATA_OFFSET(1), + struct rte_table_hash_params hash_params = { + .name = "TABLE", + .key_size = key_size, .key_offset = APP_METADATA_OFFSET(32), .key_mask = NULL, + .n_keys = 1 << 10, + .n_buckets = 1 << 10, + .f_hash = pipeline_test_hash, + .seed = 0, }; - hash_params.n_entries = 0; + hash_params.n_keys = 0; table = ops->f_create(&hash_params, 0, 1); if (table != NULL) return -1; - hash_params.n_entries = 1 << 10; - hash_params.signature_offset = APP_METADATA_OFFSET(1); - - table = ops->f_create(&hash_params, 0, 1); - if (table == NULL) - return -2; - - hash_params.signature_offset = APP_METADATA_OFFSET(0); - hash_params.key_offset = APP_METADATA_OFFSET(1); - - table = ops->f_create(&hash_params, 0, 1); - if (table == NULL) - return -3; - - hash_params.key_offset = APP_METADATA_OFFSET(32); + hash_params.n_keys = 1 << 10; hash_params.f_hash = NULL; table = ops->f_create(&hash_params, 0, 1); @@ -770,7 +758,7 @@ test_table_hash_lru_generic(struct rte_table_ops *ops) } static int -test_table_hash_ext_generic(struct rte_table_ops *ops) +test_table_hash_ext_generic(struct rte_table_ops *ops, uint32_t key_size) { int status, i; uint64_t expected_mask = 0, result_mask; @@ -782,35 +770,24 @@ test_table_hash_ext_generic(struct rte_table_ops *ops) void *entry_ptr; /* Initialize params and create tables */ - struct rte_table_hash_key8_ext_params hash_params = { - .n_entries = 1 << 10, - .n_entries_ext = 1 << 4, - .f_hash = pipeline_test_hash, - .seed = 0, - .signature_offset = APP_METADATA_OFFSET(1), + struct rte_table_hash_params hash_params = { + .name = "TABLE", + .key_size = key_size, .key_offset = APP_METADATA_OFFSET(32), .key_mask = NULL, + .n_keys = 1 << 10, + .n_buckets = 1 << 10, + .f_hash = pipeline_test_hash, + .seed = 0, }; - hash_params.n_entries = 0; + hash_params.n_keys = 0; table = ops->f_create(&hash_params, 0, 1); if (table != NULL) return -1; - hash_params.n_entries = 1 << 10; - hash_params.n_entries_ext = 0; - table = ops->f_create(&hash_params, 0, 1); - if (table != NULL) - return -2; - - hash_params.n_entries_ext = 1 << 4; - hash_params.signature_offset = APP_METADATA_OFFSET(1); - table = ops->f_create(&hash_params, 0, 1); - if (table == NULL) - return -2; - - hash_params.signature_offset = APP_METADATA_OFFSET(0); + hash_params.n_keys = 1 << 10; hash_params.key_offset = APP_METADATA_OFFSET(1); table = ops->f_create(&hash_params, 0, 1); @@ -895,20 +872,21 @@ test_table_hash_lru(void) { int status; - status = test_table_hash_lru_generic(&rte_table_hash_key8_lru_ops); - if (status < 0) - return status; - status = test_table_hash_lru_generic( - &rte_table_hash_key8_lru_dosig_ops); + &rte_table_hash_key8_lru_ops, + 8); if (status < 0) return status; - status = test_table_hash_lru_generic(&rte_table_hash_key16_lru_ops); + status = test_table_hash_lru_generic( + &rte_table_hash_key16_lru_ops, + 16); if (status < 0) return status; - status = test_table_hash_lru_generic(&rte_table_hash_key32_lru_ops); + status = test_table_hash_lru_generic( + &rte_table_hash_key32_lru_ops, + 32); if (status < 0) return status; @@ -924,20 +902,15 @@ test_table_hash_ext(void) { int status; - status = test_table_hash_ext_generic(&rte_table_hash_key8_ext_ops); + status = test_table_hash_ext_generic(&rte_table_hash_key8_ext_ops, 8); if (status < 0) return status; - status = test_table_hash_ext_generic( - &rte_table_hash_key8_ext_dosig_ops); + status = test_table_hash_ext_generic(&rte_table_hash_key16_ext_ops, 16); if (status < 0) return status; - status = test_table_hash_ext_generic(&rte_table_hash_key16_ext_ops); - if (status < 0) - return status; - - status = test_table_hash_ext_generic(&rte_table_hash_key32_ext_ops); + status = test_table_hash_ext_generic(&rte_table_hash_key32_ext_ops, 32); if (status < 0) return status; @@ -959,23 +932,24 @@ test_table_hash_cuckoo(void) uint32_t entry_size = 1; /* Initialize params and create tables */ - struct rte_table_hash_cuckoo_params cuckoo_params = { + struct rte_table_hash_params cuckoo_params = { + .name = "TABLE", .key_size = 32, - .n_keys = 1 << 24, - .f_hash = pipeline_test_hash, - .seed = 0, - .signature_offset = APP_METADATA_OFFSET(0), .key_offset = APP_METADATA_OFFSET(32), - .name = "CUCKOO", + .key_mask = NULL, + .n_keys = 1 << 16, + .n_buckets = 1 << 16, + .f_hash = (rte_table_hash_op_hash)pipeline_test_hash, + .seed = 0, }; - table = rte_table_hash_cuckoo_dosig_ops.f_create(NULL, 0, entry_size); + table = rte_table_hash_cuckoo_ops.f_create(NULL, 0, entry_size); if (table != NULL) return -1; cuckoo_params.key_size = 0; - table = rte_table_hash_cuckoo_dosig_ops.f_create(&cuckoo_params, + table = rte_table_hash_cuckoo_ops.f_create(&cuckoo_params, 0, entry_size); if (table != NULL) return -2; @@ -983,7 +957,7 @@ test_table_hash_cuckoo(void) cuckoo_params.key_size = 32; cuckoo_params.n_keys = 0; - table = rte_table_hash_cuckoo_dosig_ops.f_create(&cuckoo_params, + table = rte_table_hash_cuckoo_ops.f_create(&cuckoo_params, 0, entry_size); if (table != NULL) return -3; @@ -991,7 +965,7 @@ test_table_hash_cuckoo(void) cuckoo_params.n_keys = 1 << 24; cuckoo_params.f_hash = NULL; - table = rte_table_hash_cuckoo_dosig_ops.f_create(&cuckoo_params, + table = rte_table_hash_cuckoo_ops.f_create(&cuckoo_params, 0, entry_size); if (table != NULL) return -4; @@ -999,24 +973,24 @@ test_table_hash_cuckoo(void) cuckoo_params.f_hash = pipeline_test_hash; cuckoo_params.name = NULL; - table = rte_table_hash_cuckoo_dosig_ops.f_create(&cuckoo_params, + table = rte_table_hash_cuckoo_ops.f_create(&cuckoo_params, 0, entry_size); if (table != NULL) return -5; cuckoo_params.name = "CUCKOO"; - table = rte_table_hash_cuckoo_dosig_ops.f_create(&cuckoo_params, + table = rte_table_hash_cuckoo_ops.f_create(&cuckoo_params, 0, entry_size); if (table == NULL) return -6; /* Free */ - status = rte_table_hash_cuckoo_dosig_ops.f_free(table); + status = rte_table_hash_cuckoo_ops.f_free(table); if (status < 0) return -7; - status = rte_table_hash_cuckoo_dosig_ops.f_free(NULL); + status = rte_table_hash_cuckoo_ops.f_free(NULL); if (status == 0) return -8; @@ -1027,60 +1001,60 @@ test_table_hash_cuckoo(void) memset(key_cuckoo, 0, 32); kcuckoo[0] = rte_be_to_cpu_32(0xadadadad); - table = rte_table_hash_cuckoo_dosig_ops.f_create(&cuckoo_params, 0, 1); + table = rte_table_hash_cuckoo_ops.f_create(&cuckoo_params, 0, 1); if (table == NULL) return -9; entry = 'A'; - status = rte_table_hash_cuckoo_dosig_ops.f_add(NULL, &key_cuckoo, + status = rte_table_hash_cuckoo_ops.f_add(NULL, &key_cuckoo, &entry, &key_found, &entry_ptr); if (status == 0) return -10; - status = rte_table_hash_cuckoo_dosig_ops.f_add(table, NULL, &entry, + status = rte_table_hash_cuckoo_ops.f_add(table, NULL, &entry, &key_found, &entry_ptr); if (status == 0) return -11; - status = rte_table_hash_cuckoo_dosig_ops.f_add(table, &key_cuckoo, + status = rte_table_hash_cuckoo_ops.f_add(table, &key_cuckoo, NULL, &key_found, &entry_ptr); if (status == 0) return -12; - status = rte_table_hash_cuckoo_dosig_ops.f_add(table, &key_cuckoo, + status = rte_table_hash_cuckoo_ops.f_add(table, &key_cuckoo, &entry, &key_found, &entry_ptr); if (status != 0) return -13; - status = rte_table_hash_cuckoo_dosig_ops.f_add(table, &key_cuckoo, + status = rte_table_hash_cuckoo_ops.f_add(table, &key_cuckoo, &entry, &key_found, &entry_ptr); if (status != 0) return -14; /* Delete */ - status = rte_table_hash_cuckoo_dosig_ops.f_delete(NULL, &key_cuckoo, + status = rte_table_hash_cuckoo_ops.f_delete(NULL, &key_cuckoo, &key_found, NULL); if (status == 0) return -15; - status = rte_table_hash_cuckoo_dosig_ops.f_delete(table, NULL, + status = rte_table_hash_cuckoo_ops.f_delete(table, NULL, &key_found, NULL); if (status == 0) return -16; - status = rte_table_hash_cuckoo_dosig_ops.f_delete(table, &key_cuckoo, + status = rte_table_hash_cuckoo_ops.f_delete(table, &key_cuckoo, &key_found, NULL); if (status != 0) return -17; - status = rte_table_hash_cuckoo_dosig_ops.f_delete(table, &key_cuckoo, + status = rte_table_hash_cuckoo_ops.f_delete(table, &key_cuckoo, &key_found, NULL); if (status != -ENOENT) return -18; /* Traffic flow */ entry = 'A'; - status = rte_table_hash_cuckoo_dosig_ops.f_add(table, &key_cuckoo, + status = rte_table_hash_cuckoo_ops.f_add(table, &key_cuckoo, &entry, &key_found, &entry_ptr); if (status < 0) @@ -1093,7 +1067,7 @@ test_table_hash_cuckoo(void) } else PREPARE_PACKET(mbufs[i], 0xadadadab); - rte_table_hash_cuckoo_dosig_ops.f_lookup(table, mbufs, -1, + rte_table_hash_cuckoo_ops.f_lookup(table, mbufs, -1, &result_mask, (void **)entries); if (result_mask != expected_mask) return -20; @@ -1102,7 +1076,7 @@ test_table_hash_cuckoo(void) for (i = 0; i < RTE_PORT_IN_BURST_SIZE_MAX; i++) rte_pktmbuf_free(mbufs[i]); - status = rte_table_hash_cuckoo_dosig_ops.f_free(table); + status = rte_table_hash_cuckoo_ops.f_free(table); return 0; } diff --git a/test/test/test_timer.c b/test/test/test_timer.c index de0c312f..04c23989 100644 --- a/test/test/test_timer.c +++ b/test/test/test_timer.c @@ -126,7 +126,6 @@ #include <rte_common.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memzone.h> #include <rte_launch.h> #include <rte_cycles.h> #include <rte_eal.h> diff --git a/test/test/virtual_pmd.c b/test/test/virtual_pmd.c index 9d46ad56..b57a9493 100644 --- a/test/test/virtual_pmd.c +++ b/test/test/virtual_pmd.c @@ -34,6 +34,7 @@ #include <rte_mbuf.h> #include <rte_ethdev.h> #include <rte_pci.h> +#include <rte_bus_pci.h> #include <rte_malloc.h> #include <rte_memcpy.h> #include <rte_memory.h> @@ -211,13 +212,15 @@ virtual_ethdev_link_update_fail(struct rte_eth_dev *bonded_eth_dev __rte_unused, return -1; } -static void +static int virtual_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { struct virtual_ethdev_private *dev_private = dev->data->dev_private; if (stats) rte_memcpy(stats, &dev_private->eth_stats, sizeof(*stats)); + + return 0; } static void @@ -261,7 +264,7 @@ static const struct eth_dev_ops virtual_ethdev_default_dev_ops = { void -virtual_ethdev_start_fn_set_success(uint8_t port_id, uint8_t success) +virtual_ethdev_start_fn_set_success(uint16_t port_id, uint8_t success) { struct rte_eth_dev *dev = &rte_eth_devices[port_id]; struct virtual_ethdev_private *dev_private = dev->data->dev_private; @@ -275,7 +278,7 @@ virtual_ethdev_start_fn_set_success(uint8_t port_id, uint8_t success) } void -virtual_ethdev_configure_fn_set_success(uint8_t port_id, uint8_t success) +virtual_ethdev_configure_fn_set_success(uint16_t port_id, uint8_t success) { struct rte_eth_dev *dev = &rte_eth_devices[port_id]; struct virtual_ethdev_private *dev_private = dev->data->dev_private; @@ -288,7 +291,7 @@ virtual_ethdev_configure_fn_set_success(uint8_t port_id, uint8_t success) } void -virtual_ethdev_rx_queue_setup_fn_set_success(uint8_t port_id, uint8_t success) +virtual_ethdev_rx_queue_setup_fn_set_success(uint16_t port_id, uint8_t success) { struct rte_eth_dev *dev = &rte_eth_devices[port_id]; struct virtual_ethdev_private *dev_private = dev->data->dev_private; @@ -301,7 +304,7 @@ virtual_ethdev_rx_queue_setup_fn_set_success(uint8_t port_id, uint8_t success) } void -virtual_ethdev_tx_queue_setup_fn_set_success(uint8_t port_id, uint8_t success) +virtual_ethdev_tx_queue_setup_fn_set_success(uint16_t port_id, uint8_t success) { struct rte_eth_dev *dev = &rte_eth_devices[port_id]; struct virtual_ethdev_private *dev_private = dev->data->dev_private; @@ -314,7 +317,7 @@ virtual_ethdev_tx_queue_setup_fn_set_success(uint8_t port_id, uint8_t success) } void -virtual_ethdev_link_update_fn_set_success(uint8_t port_id, uint8_t success) +virtual_ethdev_link_update_fn_set_success(uint16_t port_id, uint8_t success) { struct rte_eth_dev *dev = &rte_eth_devices[port_id]; struct virtual_ethdev_private *dev_private = dev->data->dev_private; @@ -430,7 +433,7 @@ virtual_ethdev_tx_burst_fail(void *queue, struct rte_mbuf **bufs, void -virtual_ethdev_rx_burst_fn_set_success(uint8_t port_id, uint8_t success) +virtual_ethdev_rx_burst_fn_set_success(uint16_t port_id, uint8_t success) { struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; @@ -442,7 +445,7 @@ virtual_ethdev_rx_burst_fn_set_success(uint8_t port_id, uint8_t success) void -virtual_ethdev_tx_burst_fn_set_success(uint8_t port_id, uint8_t success) +virtual_ethdev_tx_burst_fn_set_success(uint16_t port_id, uint8_t success) { struct virtual_ethdev_private *dev_private = NULL; struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; @@ -458,7 +461,7 @@ virtual_ethdev_tx_burst_fn_set_success(uint8_t port_id, uint8_t success) } void -virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(uint8_t port_id, +virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(uint16_t port_id, uint8_t packet_fail_count) { struct virtual_ethdev_private *dev_private = NULL; @@ -470,7 +473,7 @@ virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(uint8_t port_id, } void -virtual_ethdev_set_link_status(uint8_t port_id, uint8_t link_status) +virtual_ethdev_set_link_status(uint16_t port_id, uint8_t link_status) { struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; @@ -478,7 +481,7 @@ virtual_ethdev_set_link_status(uint8_t port_id, uint8_t link_status) } void -virtual_ethdev_simulate_link_status_interrupt(uint8_t port_id, +virtual_ethdev_simulate_link_status_interrupt(uint16_t port_id, uint8_t link_status) { struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; @@ -490,7 +493,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_t port_id, } int -virtual_ethdev_add_mbufs_to_rx_queue(uint8_t port_id, +virtual_ethdev_add_mbufs_to_rx_queue(uint16_t port_id, struct rte_mbuf **pkt_burst, int burst_length) { struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; @@ -502,7 +505,7 @@ virtual_ethdev_add_mbufs_to_rx_queue(uint8_t port_id, } int -virtual_ethdev_get_mbufs_from_tx_queue(uint8_t port_id, +virtual_ethdev_get_mbufs_from_tx_queue(uint16_t port_id, struct rte_mbuf **pkt_burst, int burst_length) { struct virtual_ethdev_private *dev_private; diff --git a/test/test/virtual_pmd.h b/test/test/virtual_pmd.h index de001884..7c53dd34 100644 --- a/test/test/virtual_pmd.h +++ b/test/test/virtual_pmd.h @@ -48,53 +48,55 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, uint8_t socket_id, uint8_t isr_support); void -virtual_ethdev_set_link_status(uint8_t port_id, uint8_t link_status); +virtual_ethdev_set_link_status(uint16_t port_id, uint8_t link_status); void -virtual_ethdev_simulate_link_status_interrupt(uint8_t port_id, +virtual_ethdev_simulate_link_status_interrupt(uint16_t port_id, uint8_t link_status); int -virtual_ethdev_add_mbufs_to_rx_queue(uint8_t port_id, +virtual_ethdev_add_mbufs_to_rx_queue(uint16_t port_id, struct rte_mbuf **pkts_burst, int burst_length); int -virtual_ethdev_get_mbufs_from_tx_queue(uint8_t port_id, +virtual_ethdev_get_mbufs_from_tx_queue(uint16_t port_id, struct rte_mbuf **pkt_burst, int burst_length); /** Control methods for the dev_ops functions pointer to control the behavior * of the Virtual PMD */ void -virtual_ethdev_start_fn_set_success(uint8_t port_id, uint8_t success); +virtual_ethdev_start_fn_set_success(uint16_t port_id, uint8_t success); void -virtual_ethdev_stop_fn_set_success(uint8_t port_id, uint8_t success); +virtual_ethdev_stop_fn_set_success(uint16_t port_id, uint8_t success); void -virtual_ethdev_configure_fn_set_success(uint8_t port_id, uint8_t success); +virtual_ethdev_configure_fn_set_success(uint16_t port_id, uint8_t success); void -virtual_ethdev_rx_queue_setup_fn_set_success(uint8_t port_id, uint8_t success); +virtual_ethdev_rx_queue_setup_fn_set_success(uint16_t port_id, + uint8_t success); void -virtual_ethdev_tx_queue_setup_fn_set_success(uint8_t port_id, uint8_t success); +virtual_ethdev_tx_queue_setup_fn_set_success(uint16_t port_id, + uint8_t success); void -virtual_ethdev_link_update_fn_set_success(uint8_t port_id, uint8_t success); +virtual_ethdev_link_update_fn_set_success(uint16_t port_id, uint8_t success); void -virtual_ethdev_rx_burst_fn_set_success(uint8_t port_id, uint8_t success); +virtual_ethdev_rx_burst_fn_set_success(uint16_t port_id, uint8_t success); void -virtual_ethdev_tx_burst_fn_set_success(uint8_t port_id, uint8_t success); +virtual_ethdev_tx_burst_fn_set_success(uint16_t port_id, uint8_t success); /* if a value greater than zero is set for packet_fail_count then virtual * device tx burst function will fail that many packet from burst or all * packets if packet_fail_count is greater than the number of packets in the * burst */ void -virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(uint8_t port_id, +virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(uint16_t port_id, uint8_t packet_fail_count); #ifdef __cplusplus |