From: roy.fan.zhang@intel.com
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/8] librte_table: add key_mask parameter to 8-byte key hash parameters
Date: Fri, 25 Sep 2015 23:33:05 +0100 [thread overview]
Message-ID: <1443220392-13434-2-git-send-email-roy.fan.zhang@intel.com> (raw)
In-Reply-To: <1443220392-13434-1-git-send-email-roy.fan.zhang@intel.com>
From: Fan Zhang <roy.fan.zhang@intel.com>
This patch relates to ABI change proposed for librte_table. key_mask
parameter is added for 8-byte key extendible bucket and LRU tables.
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
lib/librte_table/rte_table_hash.h | 6 ++++
lib/librte_table/rte_table_hash_key8.c | 54 +++++++++++++++++++++++++++-------
2 files changed, 50 insertions(+), 10 deletions(-)
diff --git a/lib/librte_table/rte_table_hash.h b/lib/librte_table/rte_table_hash.h
index 9181942..ef65355 100644
--- a/lib/librte_table/rte_table_hash.h
+++ b/lib/librte_table/rte_table_hash.h
@@ -196,6 +196,9 @@ struct rte_table_hash_key8_lru_params {
/** Byte offset within packet meta-data where the key is located */
uint32_t key_offset;
+
+ /** Bit-mask to be AND-ed to the key on lookup */
+ uint8_t *key_mask;
};
/** LRU hash table operations for pre-computed key signature */
@@ -226,6 +229,9 @@ struct rte_table_hash_key8_ext_params {
/** Byte offset within packet meta-data where the key is located */
uint32_t key_offset;
+
+ /** Bit-mask to be AND-ed to the key on lookup */
+ uint8_t *key_mask;
};
/** Extendible bucket hash table operations for pre-computed key signature */
diff --git a/lib/librte_table/rte_table_hash_key8.c b/lib/librte_table/rte_table_hash_key8.c
index b351a49..ccb20cf 100644
--- a/lib/librte_table/rte_table_hash_key8.c
+++ b/lib/librte_table/rte_table_hash_key8.c
@@ -82,6 +82,7 @@ struct rte_table_hash {
uint32_t bucket_size;
uint32_t signature_offset;
uint32_t key_offset;
+ uint64_t key_mask;
rte_table_hash_op_hash f_hash;
uint64_t seed;
@@ -160,6 +161,11 @@ rte_table_hash_create_key8_lru(void *params, int socket_id, uint32_t entry_size)
f->f_hash = p->f_hash;
f->seed = p->seed;
+ if (p->key_mask != NULL)
+ f->key_mask = ((uint64_t *)p->key_mask)[0];
+ else
+ f->key_mask = 0xFFFFFFFFFFFFFFFFLLU;
+
for (i = 0; i < n_buckets; i++) {
struct rte_bucket_4_8 *bucket;
@@ -372,6 +378,11 @@ rte_table_hash_create_key8_ext(void *params, int socket_id, uint32_t entry_size)
f->stack = (uint32_t *)
&f->memory[(n_buckets + n_buckets_ext) * f->bucket_size];
+ if (p->key_mask != NULL)
+ f->key_mask = ((uint64_t *)p->key_mask)[0];
+ else
+ f->key_mask = 0xFFFFFFFFFFFFFFFFLLU;
+
for (i = 0; i < n_buckets_ext; i++)
f->stack[i] = i;
@@ -586,9 +597,12 @@ rte_table_hash_entry_delete_key8_ext(
uint64_t *key; \
uint64_t signature; \
uint32_t bucket_index; \
+ uint64_t hash_key_buffer; \
\
key = RTE_MBUF_METADATA_UINT64_PTR(mbuf1, f->key_offset);\
- signature = f->f_hash(key, RTE_TABLE_HASH_KEY_SIZE, f->seed);\
+ hash_key_buffer = *key & f->key_mask; \
+ signature = f->f_hash(&hash_key_buffer, \
+ RTE_TABLE_HASH_KEY_SIZE, f->seed); \
bucket_index = signature & (f->n_buckets - 1); \
bucket1 = (struct rte_bucket_4_8 *) \
&f->memory[bucket_index * f->bucket_size]; \
@@ -602,10 +616,12 @@ rte_table_hash_entry_delete_key8_ext(
uint64_t pkt_mask; \
uint64_t *key; \
uint32_t pos; \
+ uint64_t hash_key_buffer; \
\
key = RTE_MBUF_METADATA_UINT64_PTR(mbuf2, f->key_offset);\
+ hash_key_buffer = key[0] & f->key_mask; \
\
- lookup_key8_cmp(key, bucket2, pos); \
+ lookup_key8_cmp((&hash_key_buffer), bucket2, pos); \
\
pkt_mask = ((bucket2->signature >> pos) & 1LLU) << pkt2_index;\
pkts_mask_out |= pkt_mask; \
@@ -624,10 +640,12 @@ rte_table_hash_entry_delete_key8_ext(
uint64_t pkt_mask, bucket_mask; \
uint64_t *key; \
uint32_t pos; \
+ uint64_t hash_key_buffer; \
\
key = RTE_MBUF_METADATA_UINT64_PTR(mbuf2, f->key_offset);\
+ hash_key_buffer = *key & f->key_mask; \
\
- lookup_key8_cmp(key, bucket2, pos); \
+ lookup_key8_cmp((&hash_key_buffer), bucket2, pos); \
\
pkt_mask = ((bucket2->signature >> pos) & 1LLU) << pkt2_index;\
pkts_mask_out |= pkt_mask; \
@@ -651,11 +669,13 @@ rte_table_hash_entry_delete_key8_ext(
uint64_t pkt_mask, bucket_mask; \
uint64_t *key; \
uint32_t pos; \
+ uint64_t hash_key_buffer; \
\
bucket = buckets[pkt_index]; \
key = keys[pkt_index]; \
+ hash_key_buffer = (*key) & f->key_mask; \
\
- lookup_key8_cmp(key, bucket, pos); \
+ lookup_key8_cmp((&hash_key_buffer), bucket, pos); \
\
pkt_mask = ((bucket->signature >> pos) & 1LLU) << pkt_index;\
pkts_mask_out |= pkt_mask; \
@@ -736,6 +756,8 @@ rte_table_hash_entry_delete_key8_ext(
#define lookup2_stage1_dosig(mbuf10, mbuf11, bucket10, bucket11, f)\
{ \
uint64_t *key10, *key11; \
+ uint64_t hash_offset_buffer10; \
+ uint64_t hash_offset_buffer11; \
uint64_t signature10, signature11; \
uint32_t bucket10_index, bucket11_index; \
rte_table_hash_op_hash f_hash = f->f_hash; \
@@ -744,14 +766,18 @@ rte_table_hash_entry_delete_key8_ext(
\
key10 = RTE_MBUF_METADATA_UINT64_PTR(mbuf10, key_offset);\
key11 = RTE_MBUF_METADATA_UINT64_PTR(mbuf11, key_offset);\
+ hash_offset_buffer10 = *key10 & f->key_mask; \
+ hash_offset_buffer11 = *key11 & f->key_mask; \
\
- signature10 = f_hash(key10, RTE_TABLE_HASH_KEY_SIZE, seed);\
+ signature10 = f_hash(&hash_offset_buffer10, \
+ RTE_TABLE_HASH_KEY_SIZE, seed); \
bucket10_index = signature10 & (f->n_buckets - 1); \
bucket10 = (struct rte_bucket_4_8 *) \
&f->memory[bucket10_index * f->bucket_size]; \
rte_prefetch0(bucket10); \
\
- signature11 = f_hash(key11, RTE_TABLE_HASH_KEY_SIZE, seed);\
+ signature11 = f_hash(&hash_offset_buffer11, \
+ RTE_TABLE_HASH_KEY_SIZE, seed); \
bucket11_index = signature11 & (f->n_buckets - 1); \
bucket11 = (struct rte_bucket_4_8 *) \
&f->memory[bucket11_index * f->bucket_size]; \
@@ -764,13 +790,17 @@ rte_table_hash_entry_delete_key8_ext(
void *a20, *a21; \
uint64_t pkt20_mask, pkt21_mask; \
uint64_t *key20, *key21; \
+ uint64_t hash_offset_buffer20; \
+ uint64_t hash_offset_buffer21; \
uint32_t pos20, pos21; \
\
key20 = RTE_MBUF_METADATA_UINT64_PTR(mbuf20, f->key_offset);\
key21 = RTE_MBUF_METADATA_UINT64_PTR(mbuf21, f->key_offset);\
+ hash_offset_buffer20 = *key20 & f->key_mask; \
+ hash_offset_buffer21 = *key21 & f->key_mask; \
\
- lookup_key8_cmp(key20, bucket20, pos20); \
- lookup_key8_cmp(key21, bucket21, pos21); \
+ lookup_key8_cmp((&hash_offset_buffer20), bucket20, pos20);\
+ lookup_key8_cmp((&hash_offset_buffer21), bucket21, pos21);\
\
pkt20_mask = ((bucket20->signature >> pos20) & 1LLU) << pkt20_index;\
pkt21_mask = ((bucket21->signature >> pos21) & 1LLU) << pkt21_index;\
@@ -793,13 +823,17 @@ rte_table_hash_entry_delete_key8_ext(
void *a20, *a21; \
uint64_t pkt20_mask, pkt21_mask, bucket20_mask, bucket21_mask;\
uint64_t *key20, *key21; \
+ uint64_t hash_offset_buffer20; \
+ uint64_t hash_offset_buffer21; \
uint32_t pos20, pos21; \
\
key20 = RTE_MBUF_METADATA_UINT64_PTR(mbuf20, f->key_offset);\
key21 = RTE_MBUF_METADATA_UINT64_PTR(mbuf21, f->key_offset);\
+ hash_offset_buffer20 = *key20 & f->key_mask; \
+ hash_offset_buffer21 = *key21 & f->key_mask; \
\
- lookup_key8_cmp(key20, bucket20, pos20); \
- lookup_key8_cmp(key21, bucket21, pos21); \
+ lookup_key8_cmp((&hash_offset_buffer20), bucket20, pos20);\
+ lookup_key8_cmp((&hash_offset_buffer21), bucket21, pos21);\
\
pkt20_mask = ((bucket20->signature >> pos20) & 1LLU) << pkt20_index;\
pkt21_mask = ((bucket21->signature >> pos21) & 1LLU) << pkt21_index;\
--
2.1.0
next prev parent reply other threads:[~2015-09-25 22:33 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 22:33 [dpdk-dev] [PATCH 0/8] librte_table: add key_mask parameter to 8-byte key roy.fan.zhang
2015-09-25 22:33 ` roy.fan.zhang [this message]
2015-09-25 22:33 ` [dpdk-dev] [PATCH 2/8] librte_table: add key_mask parameter to 16-byte key hash parameters roy.fan.zhang
2015-09-25 22:33 ` [dpdk-dev] [PATCH 3/8] librte_table: add 16 byte hash table operations with computed lookup roy.fan.zhang
2015-09-25 22:33 ` [dpdk-dev] [PATCH 4/8] app/test: modify app/test_table_combined and app/test_table_tables roy.fan.zhang
2015-09-25 22:33 ` [dpdk-dev] [PATCH 5/8] app/test-pipeline: modify pipeline test roy.fan.zhang
2015-09-25 22:33 ` [dpdk-dev] [PATCH 6/8] example/ip_pipeline: add parse_hex_string for internal use roy.fan.zhang
2015-09-25 22:33 ` [dpdk-dev] [PATCH 7/8] example/ip_pipeline/pipeline: update flow_classification pipeline roy.fan.zhang
2015-09-25 22:33 ` [dpdk-dev] [PATCH 8/8] librte_table: modify release notes and deprecation notice roy.fan.zhang
2015-10-12 14:24 ` Thomas Monjalon
2015-10-12 16:30 ` Mcnamara, John
2015-10-13 13:57 ` [dpdk-dev] [PATCH v2 0/8] librte_table: add key_mask parameter to 8-byte key Jasvinder Singh
2015-10-13 13:57 ` [dpdk-dev] [PATCH v2 1/8] librte_table: add key_mask parameter to 8-byte key hash parameters Jasvinder Singh
2015-10-13 13:57 ` [dpdk-dev] [PATCH v2 2/8] librte_table: add key_mask parameter to 16-byte " Jasvinder Singh
2015-10-13 13:57 ` [dpdk-dev] [PATCH v2 3/8] librte_table: add 16 byte hash table operations with computed lookup Jasvinder Singh
2015-10-13 13:57 ` [dpdk-dev] [PATCH v2 4/8] app/test: modify app/test_table_combined and app/test_table_tables Jasvinder Singh
2015-10-13 13:57 ` [dpdk-dev] [PATCH v2 5/8] app/test-pipeline: modify pipeline test Jasvinder Singh
2015-10-13 13:57 ` [dpdk-dev] [PATCH v2 6/8] example/ip_pipeline: add parse_hex_string for internal use Jasvinder Singh
2015-10-19 13:49 ` Thomas Monjalon
2015-10-20 14:31 ` Dumitrescu, Cristian
2015-10-13 13:57 ` [dpdk-dev] [PATCH v2 7/8] example/ip_pipeline/pipeline: update flow_classification pipeline Jasvinder Singh
2015-10-19 13:57 ` Thomas Monjalon
2015-10-13 13:57 ` [dpdk-dev] [PATCH v2 8/8] librte_table: modify release notes and deprecation notice Jasvinder Singh
2015-10-21 12:18 ` [dpdk-dev] [PATCH v3 0/6] librte_table: add key_mask parameter to hash table parameter structure Jasvinder Singh
2015-10-21 12:18 ` [dpdk-dev] [PATCH v3 1/6] librte_table: add key_mask parameter to 8- and 16-bytes key hash parameters Jasvinder Singh
2015-10-21 12:18 ` [dpdk-dev] [PATCH v3 2/6] librte_table: add 16 byte hash table operations with computed lookup Jasvinder Singh
2015-10-21 12:18 ` [dpdk-dev] [PATCH v3 3/6] app/test: modify app/test_table_combined and app/test_table_tables Jasvinder Singh
2015-10-21 12:18 ` [dpdk-dev] [PATCH v3 4/6] app/test-pipeline: modify pipeline test Jasvinder Singh
2015-10-21 12:18 ` [dpdk-dev] [PATCH v3 5/6] example/ip_pipeline: add parse_hex_string for internal use Jasvinder Singh
2015-10-21 12:18 ` [dpdk-dev] [PATCH v3 6/6] example/ip_pipeline/pipeline: update flow_classification pipeline Jasvinder Singh
2015-10-19 13:31 ` [dpdk-dev] [PATCH 8/8] librte_table: modify release notes and deprecation notice Thomas Monjalon
2015-09-28 20:07 ` [dpdk-dev] [PATCH 0/8] librte_table: add key_mask parameter to 8-byte key Dumitrescu, Cristian
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=1443220392-13434-2-git-send-email-roy.fan.zhang@intel.com \
--to=roy.fan.zhang@intel.com \
--cc=dev@dpdk.org \
/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).