summaryrefslogtreecommitdiff
path: root/test/test-pipeline
diff options
context:
space:
mode:
authorCristian Dumitrescu <cristian.dumitrescu@intel.com>2017-10-18 16:03:50 +0100
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>2017-10-24 13:10:08 +0200
commit71afef2c14c62fa49c3fb8c10cccb0a0f472c61c (patch)
tree00ad06eb94c4bc3349642715462e7bb71c5125b4 /test/test-pipeline
parentec35c73ec6470e92afd5cab8cef748e8484a1187 (diff)
downloaddpdk-71afef2c14c62fa49c3fb8c10cccb0a0f472c61c.zip
dpdk-71afef2c14c62fa49c3fb8c10cccb0a0f472c61c.tar.gz
dpdk-71afef2c14c62fa49c3fb8c10cccb0a0f472c61c.tar.xz
apps: add mask-based hash functions
Introduce mask-based hash functions in hash_func.h. Propagate their usage in test/test, test/test-pipeline and examples/ip_pipeline. Remove the non-mask-based hash function prototype from API (which was previously used as build workaround). Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Diffstat (limited to 'test/test-pipeline')
-rw-r--r--test/test-pipeline/main.h5
-rw-r--r--test/test-pipeline/pipeline_hash.c113
2 files changed, 17 insertions, 101 deletions
diff --git a/test/test-pipeline/main.h b/test/test-pipeline/main.h
index 3685849..26395a3 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 24df81c..edc1663 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_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 = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_ext_ops,
.arg_create = &table_hash_params,
@@ -204,17 +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_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 = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_lru_ops,
.arg_create = &table_hash_params,
@@ -231,17 +220,6 @@ app_main_loop_worker_pipeline_hash(void) {
case e_APP_PIPELINE_HASH_SPEC_KEY8_EXT:
{
- 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 = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key8_ext_ops,
.arg_create = &table_hash_params,
@@ -258,17 +236,6 @@ app_main_loop_worker_pipeline_hash(void) {
case e_APP_PIPELINE_HASH_SPEC_KEY8_LRU:
{
- 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 = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key8_lru_ops,
.arg_create = &table_hash_params,
@@ -285,17 +252,6 @@ app_main_loop_worker_pipeline_hash(void) {
case e_APP_PIPELINE_HASH_SPEC_KEY16_EXT:
{
- 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 = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key16_ext_ops,
.arg_create = &table_hash_params,
@@ -312,17 +268,6 @@ app_main_loop_worker_pipeline_hash(void) {
case e_APP_PIPELINE_HASH_SPEC_KEY16_LRU:
{
- 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 = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key16_lru_ops,
.arg_create = &table_hash_params,
@@ -339,17 +284,6 @@ app_main_loop_worker_pipeline_hash(void) {
case e_APP_PIPELINE_HASH_SPEC_KEY32_EXT:
{
- 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 = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key32_ext_ops,
.arg_create = &table_hash_params,
@@ -367,17 +301,6 @@ app_main_loop_worker_pipeline_hash(void) {
case e_APP_PIPELINE_HASH_SPEC_KEY32_LRU:
{
- 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 = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key32_lru_ops,
.arg_create = &table_hash_params,
@@ -402,17 +325,6 @@ app_main_loop_worker_pipeline_hash(void) {
case e_APP_PIPELINE_HASH_CUCKOO_KEY112:
case e_APP_PIPELINE_HASH_CUCKOO_KEY128:
{
- 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 = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_cuckoo_ops,
.arg_create = &table_hash_params,
@@ -485,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)
{
@@ -547,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 {