DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sankar Chokkalingam <sankarx.chokkalingam@intel.com>
To: dev@dpdk.org
Cc: cristian.dumitrescu@intel.com, jasvinder.singh@intel.com,
	sankarx.chokkalingam@intel.com,
	Guruprasad Rao <guruprasadx.rao@intel.com>
Subject: [dpdk-dev] [PATCH 2/3] app/test-pipeline: added cuckoo hash for benchmarking
Date: Thu, 22 Sep 2016 03:12:06 -0700	[thread overview]
Message-ID: <1474539127-232221-3-git-send-email-sankarx.chokkalingam@intel.com> (raw)
In-Reply-To: <1474539127-232221-1-git-send-email-sankarx.chokkalingam@intel.com>

From: Guruprasad Rao <guruprasadx.rao@intel.com>

This patch inclides cuckoo hash table into test-pipeline
This allows to benchmark the performance of the cuckoo hash table
The following key sizes are supported for cuckoo hash table
8, 16, 32, 48, 64, 80, 96, 112 and 128.

The test-pipeline can be run using the following command
say for key size 8
./app/testpipeline -c 0xe -n 4 -- -p 0xf --hash-cuckoo-8

Signed-off-by: Sankar Chokkalingam <sankarx.chokkalingam@intel.com>
Signed-off-by: Guruprasad Rao <guruprasadx.rao@intel.com>
---
v2:
* Fixed coding style errors

v1:
* changes to app/test-pipeline files to include cuckoo hash table
  test-pipeline

 app/test-pipeline/config.c        | 20 ++++++++++++-
 app/test-pipeline/main.c          | 12 +++++++-
 app/test-pipeline/main.h          | 12 +++++++-
 app/test-pipeline/pipeline_hash.c | 59 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 100 insertions(+), 3 deletions(-)

diff --git a/app/test-pipeline/config.c b/app/test-pipeline/config.c
index c7bc937..dd80ed6 100644
--- a/app/test-pipeline/config.c
+++ b/app/test-pipeline/config.c
@@ -1,7 +1,7 @@
 /*-
  *   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
@@ -139,6 +139,15 @@ struct {
 	{"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
@@ -166,6 +175,15 @@ app_parse_args(int argc, char **argv)
 		{"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;
diff --git a/app/test-pipeline/main.c b/app/test-pipeline/main.c
index c57e4dd..71ab6ad 100644
--- a/app/test-pipeline/main.c
+++ b/app/test-pipeline/main.c
@@ -1,7 +1,7 @@
 /*-
  *   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
@@ -143,6 +143,16 @@ app_lcore_main_loop(__attribute__((unused)) void *arg)
 		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;
 
diff --git a/app/test-pipeline/main.h b/app/test-pipeline/main.h
index 8dcd459..3685849 100644
--- a/app/test-pipeline/main.h
+++ b/app/test-pipeline/main.h
@@ -1,7 +1,7 @@
 /*-
  *   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
@@ -116,6 +116,16 @@ enum {
 	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
 };
 
diff --git a/app/test-pipeline/pipeline_hash.c b/app/test-pipeline/pipeline_hash.c
index f8aac0d..8cdba49 100644
--- a/app/test-pipeline/pipeline_hash.c
+++ b/app/test-pipeline/pipeline_hash.c
@@ -43,6 +43,7 @@
 
 #include <rte_port_ring.h>
 #include <rte_table_hash.h>
+#include <rte_hash.h>
 #include <rte_pipeline.h>
 
 #include "main.h"
@@ -77,6 +78,25 @@ translate_options(uint32_t *special, uint32_t *ext, uint32_t *key_size)
 	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");
 	}
@@ -360,6 +380,45 @@ app_main_loop_worker_pipeline_hash(void) {
 	}
 	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");
 	}
-- 
2.5.0

  parent reply	other threads:[~2016-09-22 10:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 10:12 [dpdk-dev] [PATCH 0/3] changes for enabling cuckoo hash into table library Sankar Chokkalingam
2016-09-22 10:12 ` [dpdk-dev] [PATCH 1/3] lib/librte_table: " Sankar Chokkalingam
2016-09-22 10:12 ` Sankar Chokkalingam [this message]
2016-09-22 10:12 ` [dpdk-dev] [PATCH 3/3] app/test: adding cuckoo hash table for testing Sankar Chokkalingam
2016-09-23 12:54 ` [dpdk-dev] [PATCH 0/3] changes for enabling cuckoo hash into table library Dumitrescu, Cristian
2016-10-12 20:11   ` Thomas Monjalon
  -- strict thread matches above, loose matches on Subject: below --
2016-08-27  0:01 [dpdk-dev] [PATCH 2/3] app/test-pipeline: added cuckoo hash for benchmarking Sankar Chokkalingam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474539127-232221-3-git-send-email-sankarx.chokkalingam@intel.com \
    --to=sankarx.chokkalingam@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=guruprasadx.rao@intel.com \
    --cc=jasvinder.singh@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).