/*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
        {"acl", e_APP_PIPELINE_ACL},
        {"lpm", e_APP_PIPELINE_LPM},
        {"lpm-ipv6", e_APP_PIPELINE_LPM_IPV6},
+       {"hash-cuckoo-8", e_APP_PIPELINE_HASH_CUCKOO_KEY8},
+       {"hash-cuckoo-16", e_APP_PIPELINE_HASH_CUCKOO_KEY16},
+       {"hash-cuckoo-32", e_APP_PIPELINE_HASH_CUCKOO_KEY32},
+       {"hash-cuckoo-48", e_APP_PIPELINE_HASH_CUCKOO_KEY48},
+       {"hash-cuckoo-64", e_APP_PIPELINE_HASH_CUCKOO_KEY64},
+       {"hash-cuckoo-80", e_APP_PIPELINE_HASH_CUCKOO_KEY80},
+       {"hash-cuckoo-96", e_APP_PIPELINE_HASH_CUCKOO_KEY96},
+       {"hash-cuckoo-112", e_APP_PIPELINE_HASH_CUCKOO_KEY112},
+       {"hash-cuckoo-128", e_APP_PIPELINE_HASH_CUCKOO_KEY128},
 };
 
 int
                {"acl", 0, 0, 0},
                {"lpm", 0, 0, 0},
                {"lpm-ipv6", 0, 0, 0},
+               {"hash-cuckoo-8", 0, 0, 0},
+               {"hash-cuckoo-16", 0, 0, 0},
+               {"hash-cuckoo-32", 0, 0, 0},
+               {"hash-cuckoo-48", 0, 0, 0},
+               {"hash-cuckoo-64", 0, 0, 0},
+               {"hash-cuckoo-80", 0, 0, 0},
+               {"hash-cuckoo-96", 0, 0, 0},
+               {"hash-cuckoo-112", 0, 0, 0},
+               {"hash-cuckoo-128", 0, 0, 0},
                {NULL, 0, 0, 0}
        };
        uint32_t lcores[3], n_lcores, lcore_id, pipeline_type_provided;
 
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
                case e_APP_PIPELINE_HASH_SPEC_KEY16_LRU:
                case e_APP_PIPELINE_HASH_SPEC_KEY32_EXT:
                case e_APP_PIPELINE_HASH_SPEC_KEY32_LRU:
+               /* cases for cuckoo hash table types */
+               case e_APP_PIPELINE_HASH_CUCKOO_KEY8:
+               case e_APP_PIPELINE_HASH_CUCKOO_KEY16:
+               case e_APP_PIPELINE_HASH_CUCKOO_KEY32:
+               case e_APP_PIPELINE_HASH_CUCKOO_KEY48:
+               case e_APP_PIPELINE_HASH_CUCKOO_KEY64:
+               case e_APP_PIPELINE_HASH_CUCKOO_KEY80:
+               case e_APP_PIPELINE_HASH_CUCKOO_KEY96:
+               case e_APP_PIPELINE_HASH_CUCKOO_KEY112:
+               case e_APP_PIPELINE_HASH_CUCKOO_KEY128:
                        app_main_loop_worker_pipeline_hash();
                        return 0;
 
 
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
        e_APP_PIPELINE_ACL,
        e_APP_PIPELINE_LPM,
        e_APP_PIPELINE_LPM_IPV6,
+
+       e_APP_PIPELINE_HASH_CUCKOO_KEY8,
+       e_APP_PIPELINE_HASH_CUCKOO_KEY16,
+       e_APP_PIPELINE_HASH_CUCKOO_KEY32,
+       e_APP_PIPELINE_HASH_CUCKOO_KEY48,
+       e_APP_PIPELINE_HASH_CUCKOO_KEY64,
+       e_APP_PIPELINE_HASH_CUCKOO_KEY80,
+       e_APP_PIPELINE_HASH_CUCKOO_KEY96,
+       e_APP_PIPELINE_HASH_CUCKOO_KEY112,
+       e_APP_PIPELINE_HASH_CUCKOO_KEY128,
        e_APP_PIPELINES
 };
 
 
 
 #include <rte_port_ring.h>
 #include <rte_table_hash.h>
+#include <rte_hash.h>
 #include <rte_pipeline.h>
 
 #include "main.h"
        case e_APP_PIPELINE_HASH_SPEC_KEY32_LRU:
                *special = 1; *ext = 0; *key_size = 32; return;
 
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY8:
+               *special = 0; *ext = 0; *key_size = 8; return;
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY16:
+               *special = 0; *ext = 0; *key_size = 16; return;
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY32:
+               *special = 0; *ext = 0; *key_size = 32; return;
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY48:
+               *special = 0; *ext = 0; *key_size = 48; return;
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY64:
+               *special = 0; *ext = 0; *key_size = 64; return;
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY80:
+               *special = 0; *ext = 0; *key_size = 80; return;
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY96:
+               *special = 0; *ext = 0; *key_size = 96; return;
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY112:
+               *special = 0; *ext = 0; *key_size = 112; return;
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY128:
+               *special = 0; *ext = 0; *key_size = 128; return;
+
        default:
                rte_panic("Invalid hash table type or key size\n");
        }
        }
        break;
 
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY8:
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY16:
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY32:
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY48:
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY64:
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY80:
+       case e_APP_PIPELINE_HASH_CUCKOO_KEY96:
+       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,
+                       .arg_create = &table_hash_params,
+                       .f_action_hit = NULL,
+                       .f_action_miss = NULL,
+                       .arg_ah = NULL,
+                       .action_data_size = 0,
+               };
+
+               if (rte_pipeline_table_create(p, &table_params, &table_id))
+                       rte_panic("Unable to configure the hash table\n");
+       }
+       break;
+
        default:
                rte_panic("Invalid hash table type or key size\n");
        }