X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=test%2Ftest-pipeline%2Fpipeline_hash.c;h=3e4a0a1bb279f319289dadeb117ed2ab2d83a4bf;hb=039cfce658ed9e8752f44c11310130b290bd04eb;hp=11e2402d07007068dd65faaca74fc5b4f1e3d977;hpb=e2887d5f5796d648af79a77cda62bff7e8bf4249;p=dpdk.git diff --git a/test/test-pipeline/pipeline_hash.c b/test/test-pipeline/pipeline_hash.c index 11e2402d07..3e4a0a1bb2 100644 --- a/test/test-pipeline/pipeline_hash.c +++ b/test/test-pipeline/pipeline_hash.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "main.h" @@ -151,6 +152,17 @@ app_main_loop_worker_pipeline_hash(void) { .seed = 0, }; + struct rte_table_hash_cuckoo_params table_hash_cuckoo_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_cuckoo, + .seed = 0, + }; + /* Table configuration */ switch (app.pipeline_type) { case e_APP_PIPELINE_HASH_KEY8_EXT: @@ -298,7 +310,7 @@ app_main_loop_worker_pipeline_hash(void) { { struct rte_pipeline_table_params table_params = { .ops = &rte_table_hash_cuckoo_ops, - .arg_create = &table_hash_params, + .arg_create = &table_hash_cuckoo_params, .f_action_hit = NULL, .f_action_miss = NULL, .arg_ah = NULL, @@ -379,6 +391,18 @@ uint64_t test_hash( return signature; } +uint32_t test_hash_cuckoo( + const void *key, + __attribute__((unused)) uint32_t key_size, + __attribute__((unused)) uint32_t seed) +{ + const uint32_t *k32 = key; + uint32_t ip_dst = rte_be_to_cpu_32(k32[0]); + uint32_t signature = (ip_dst >> 2) | ((ip_dst & 0x3) << 30); + + return signature; +} + void app_main_loop_rx_metadata(void) { uint32_t i, j; @@ -417,14 +441,14 @@ app_main_loop_rx_metadata(void) { if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { ip_hdr = (struct ipv4_hdr *) - &m_data[sizeof(struct ether_hdr)]; + &m_data[sizeof(struct rte_ether_hdr)]; ip_dst = ip_hdr->dst_addr; k32 = (uint32_t *) key; k32[0] = ip_dst & 0xFFFFFF00; } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { ipv6_hdr = (struct ipv6_hdr *) - &m_data[sizeof(struct ether_hdr)]; + &m_data[sizeof(struct rte_ether_hdr)]; ipv6_dst = ipv6_hdr->dst_addr; memcpy(key, ipv6_dst, 16);