librte_table: add key_mask parameter to
v4 cover librte_table: add key_mask parameter to
From: Fan Zhang <[email protected]>
This patchset links to ABI change announced for librte_table. The key_mask parameters has been added to the hash table parameter structure for 8-byte key and 16-byte key extendible bucket and LRU tables.
v2:
*updated release note
v3:
*merged release note with source code patch
*fixed build error: added missing symbol to
librte_table/rte_table_version.map
v4:
*modified rte_prefetch offsets to improve hash/lru table lookup performance.
Fan Zhang (7):
librte_table: add key_mask parameter to 8- and 16-bytes key hash
parameters
librte_table: add 16 byte hash table operations with computed lookup app/test: modify app/test_table_combined and app/test_table_tables app/test-pipeline: modify pipeline test example/ip_pipeline: add parse_hex_string for internal use example/ip_pipeline/pipeline: update flow_classification pipeline
librte_table: performance improvement on rte_prefetch offset
app/test-pipeline/pipeline_hash.c | 4 + app/test/test_table_combined.c | 5 +- app/test/test_table_tables.c | 6 +- doc/guides/rel_notes/deprecation.rst | 4 - doc/guides/rel_notes/release_2_2.rst | 4 + examples/ip_pipeline/config_parse.c | 52 +++ .../pipeline/pipeline_flow_classification_be.c | 56 ++- examples/ip_pipeline/pipeline_be.h | 4 + lib/librte_table/rte_table_hash.h | 20 + lib/librte_table/rte_table_hash_ext.c | 10 +- lib/librte_table/rte_table_hash_key16.c | 446 +++++++++++++++++++-- lib/librte_table/rte_table_hash_key32.c | 35 +- lib/librte_table/rte_table_hash_key8.c | 105 +++-- lib/librte_table/rte_table_hash_lru.c | 10 +- lib/librte_table/rte_table_version.map | 7 + 15 files changed, 673 insertions(+), 95 deletions(-)
Signature · 1 line
2.1.0
PATCH v4 1/7 librte_table: add key_mask parameter to 8- and 16-bytes key hash parameters
From: Fan Zhang <[email protected]>
This patch relates to ABI change proposed for librte_table. The key_mask parameter is added for 8-byte and 16-byte key extendible bucket and LRU tables.The release notes is updated and the deprecation notice is removed.
--- doc/guides/rel_notes/deprecation.rst | 4 --- doc/guides/rel_notes/release_2_2.rst | 4 +++ lib/librte_table/rte_table_hash.h | 12 ++++++++ lib/librte_table/rte_table_hash_key16.c | 52 ++++++++++++++++++++++++++----- lib/librte_table/rte_table_hash_key8.c | 54 +++++++++++++++++++++++++++------ lib/librte_table/rte_table_version.map | 7 +++++ 6 files changed, 112 insertions(+), 21 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
@@ -44,10 +44,6 @@ Deprecation Notices * librte_table: New functions for table entry bulk add/delete will be added to the table operations structure. -* librte_table hash: Key mask parameter will be added to the hash table - parameter structure for 8-byte key and 16-byte key extendible bucket and - LRU tables. - * librte_pipeline: The prototype for the pipeline input port, output port and table action handlers will be updated: the pipeline parameter will be added, the packets mask parameter will be
doc/guides/rel_notes/release_2_2.rst +4 -0
@@ -132,6 +132,10 @@ ABI Changes * librte_cfgfile: Allow longer names and values by increasing the constants CFG_NAME_LEN and CFG_VALUE_LEN to 64 and 256 respectively. +* librte_table hash: The key mask parameter is added to the hash table + parameter structure for 8-byte key and 16-byte key extendible bucket + and LRU tables. + Shared Library Versions -----------------------
lib/librte_table/rte_table_hash.h +12 -0
@@ -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 */
@@ -257,6 +263,9 @@ struct rte_table_hash_key16_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 */
@@ -284,6 +293,9 @@ struct rte_table_hash_key16_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 operations for pre-computed key signature */
lib/librte_table/rte_table_hash_key16.c +45 -7
123 lines not on this page · raw message
lib/librte_table/rte_table_hash_key8.c +44 -10
148 lines not on this page · raw message
lib/librte_table/rte_table_version.map +7 -0
@@ -19,3 +19,10 @@ DPDK_2.0 { local: *; }; + +DPDK_2.2 { + global: + + rte_table_hash_key16_ext_dosig_ops; + +} DPDK_2.0;
Signature · 1 line
2.1.0
PATCH v4 2/7 librte_table: add 16 byte hash table operations with computed lookup
In reply to [email protected]From: Fan Zhang <[email protected]>
This patch is to adding hash table operations for key signature computed on lookup ("do-sig") for LRU hash tables and Extendible buckets.
--- lib/librte_table/rte_table_hash.h | 8 + lib/librte_table/rte_table_hash_key16.c | 359 +++++++++++++++++++++++++++++++- 2 files changed, 364 insertions(+), 3 deletions(-)
lib/librte_table/rte_table_hash.h +8 -0
@@ -271,6 +271,10 @@ struct rte_table_hash_key16_lru_params {/** LRU hash table operations for pre-computed key signature */ extern struct rte_table_ops rte_table_hash_key16_lru_ops; +/** LRU hash table operations for key signature computed on lookup +("do-sig") */ +extern struct rte_table_ops rte_table_hash_key16_lru_dosig_ops; +/** Extendible bucket hash table parameters */ struct rte_table_hash_key16_ext_params {/** Maximum number of entries (and keys) in the table */
@@ -301,6 +305,10 @@ struct rte_table_hash_key16_ext_params {/** Extendible bucket operations for pre-computed key signature */ extern struct rte_table_ops rte_table_hash_key16_ext_ops; +/** Extendible bucket hash table operations for key signature computed on +lookup ("do-sig") */ +extern struct rte_table_ops rte_table_hash_key16_ext_dosig_ops; +/** * 32-byte key hash tables *
lib/librte_table/rte_table_hash_key16.c +356 -3
406 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v4 3/7 app/test: modify app/test_table_combined and app/test_table_tables
In reply to [email protected]From: Fan Zhang <[email protected]>
Tests have been updated to work on added key_mask parameter for 8-byte key extendible bucket and LRU tables.
--- app/test/test_table_combined.c | 5 ++++- app/test/test_table_tables.c | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
app/test/test_table_combined.c +4 -1
@@ -418,9 +418,9 @@ test_table_hash8lru(void)struct rte_table_hash_key8_lru_params key8lru_params = { .n_entries =1 <<24 , .f_hash = pipeline_test_hash, - .seed =0 , .signature_offset =APP_METADATA_OFFSET (0 ), .key_offset =APP_METADATA_OFFSET (32 ), + .key_mask =NULL , };uint8_t key8lru[8 ];
@@ -479,6 +479,7 @@ test_table_hash16lru(void) .seed = 0, .signature_offset = APP_METADATA_OFFSET(0), .key_offset = APP_METADATA_OFFSET(32), + .key_mask = NULL, };uint8_t key16lru[16 ];
@@ -596,6 +597,7 @@ test_table_hash8ext(void) .seed = 0, .signature_offset = APP_METADATA_OFFSET(0), .key_offset = APP_METADATA_OFFSET(32), + .key_mask = NULL, };uint8_t key8ext[8 ];
@@ -662,6 +664,7 @@ test_table_hash16ext(void) .seed = 0, .signature_offset = APP_METADATA_OFFSET(0), .key_offset = APP_METADATA_OFFSET(32), + .key_mask = NULL, };uint8_t key16ext[16 ];
app/test/test_table_tables.c +4 -2
@@ -669,7 +669,8 @@ test_table_hash_lru_generic(struct rte_table_ops *ops) .f_hash = pipeline_test_hash, .seed = 0, .signature_offset = APP_METADATA_OFFSET(1), - .key_offset = APP_METADATA_OFFSET(32) + .key_offset = APP_METADATA_OFFSET(32), + .key_mask = NULL, }; hash_params.n_entries =0 ;
@@ -784,7 +785,8 @@ test_table_hash_ext_generic(struct rte_table_ops *ops) .f_hash = pipeline_test_hash, .seed = 0, .signature_offset = APP_METADATA_OFFSET(1), - .key_offset = APP_METADATA_OFFSET(32) + .key_offset = APP_METADATA_OFFSET(32), + .key_mask = NULL, }; hash_params.n_entries =0 ;
Signature · 1 line
2.1.0
PATCH v4 4/7 app/test-pipeline: modify pipeline test
In reply to [email protected]From: Fan Zhang <[email protected]>
Test-pipeline has been updated to work on addedkey_mask parameter for 8-byte key extendible
bucket and LRU tables.
--- app/test-pipeline/pipeline_hash.c | 4 ++++ 1 file changed, 4 insertions(+)
app/test-pipeline/pipeline_hash.c +4 -0
@@ -216,6 +216,7 @@ app_main_loop_worker_pipeline_hash(void) { .n_entries_ext = 1 << 23, .signature_offset = APP_METADATA_OFFSET(0), .key_offset = APP_METADATA_OFFSET(32), + .key_mask = NULL, .f_hash = test_hash, .seed = 0, };
@@ -240,6 +241,7 @@ app_main_loop_worker_pipeline_hash(void) { .n_entries = 1 << 24, .signature_offset = APP_METADATA_OFFSET(0), .key_offset = APP_METADATA_OFFSET(32), + .key_mask = NULL, .f_hash = test_hash, .seed = 0, };
@@ -267,6 +269,7 @@ app_main_loop_worker_pipeline_hash(void) { .key_offset = APP_METADATA_OFFSET(32), .f_hash = test_hash, .seed = 0, + .key_mask = NULL, };struct rte_pipeline_table_params table_params = {
@@ -291,6 +294,7 @@ app_main_loop_worker_pipeline_hash(void) { .key_offset = APP_METADATA_OFFSET(32), .f_hash = test_hash, .seed = 0, + .key_mask = NULL, };struct rte_pipeline_table_params table_params = {
Signature · 1 line
2.1.0
PATCH v4 5/7 example/ip_pipeline: add parse_hex_string for internal use
In reply to [email protected]From: Fan Zhang <[email protected]>
This patch adds parse_hex_string function to parse hex string to uint8_t array.
--- examples/ip_pipeline/config_parse.c | 52 +++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/pipeline_be.h | 4 +++ 2 files changed, 56 insertions(+)
examples/ip_pipeline/config_parse.c +52 -0
@@ -455,6 +455,58 @@ parse_pipeline_core(uint32_t *socket,return 0 ; } +static uint32_t +get_hex_val (char c) +{ +switch (c) { +case '0' :case '1' :case '2' :case '3' :case '4' :case '5' : +case '6' :case '7' :case '8' :case '9' : +return c -'0' ; +case 'A' :case 'B' :case 'C' :case 'D' :case 'E' :case 'F' : +return c -'A' +10 ; +case 'a' :case 'b' :case 'c' :case 'd' :case 'e' :case 'f' : +return c -'a' +10 ; +default : +return 0 ; + } +} + +int +parse_hex_string (char *src,uint8_t *dst,uint32_t *size) +{ +char *c; +uint32_t len, i; + +/* Check input parameters */ +if ((src ==NULL ) || + (dst ==NULL ) || + (size ==NULL ) || + (*size ==0 )) +return -1 ; + + len =strlen (src); +if (((len &3 ) !=0 ) || + (len > (*size) *2 )) +return -1 ; + *size = len /2 ; + +for (c = src; *c !=0 ; c++) { +if ((((*c) >='0' ) && ((*c) <='9' )) || + (((*c) >='A' ) && ((*c) <='F' )) || + (((*c) >='a' ) && ((*c) <='f' ))) +continue ; + +return -1 ; + } + +/* Convert chars to bytes */ +for (i =0 ; i < *size; i++) + dst[i] =get_hex_val (src[2 * i]) *16 + +get_hex_val (src[2 * i +1 ]); + +return 0 ; +} +static size_t skip_digits (const char *src) {
examples/ip_pipeline/pipeline_be.h +4 -0
@@ -253,4 +253,8 @@ struct pipeline_be_ops { pipeline_be_op_track f_track; }; +/* Parse hex string to uint8_t array */ +int +parse_hex_string (char *src,uint8_t *dst,uint32_t *size); +#endif
Signature · 1 line
2.1.0
PATCH v4 6/7 example/ip_pipeline/pipeline: update flow_classification pipeline
In reply to [email protected]From: Fan Zhang <[email protected]>
This patch updates the flow_classification pipeline for added key_mask parameter in 8/16-byte key hash parameters. The update provides user optional key_mask configuration item applying to the packets.
--- .../pipeline/pipeline_flow_classification_be.c | 56 ++++++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-)
examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c +52 -4
@@ -37,6 +37,7 @@#include <rte_malloc.h> #include <rte_table_hash.h> #include <rte_byteorder.h> +#include <pipeline.h> #include "pipeline_flow_classification_be.h" #include "hash_func.h"
@@ -49,6 +50,7 @@ struct pipeline_flow_classification {uint32_t key_offset;uint32_t key_size;uint32_t hash_offset; +uint8_t *key_mask; } __rte_cache_aligned; static void *
@@ -125,8 +127,12 @@ pipeline_fc_parse_args(struct pipeline_flow_classification *p,uint32_t key_offset_present =0 ;uint32_t key_size_present =0 ;uint32_t hash_offset_present =0 ; +uint32_t key_mask_present =0 ;uint32_t i; +char *key_mask_str =NULL ; + + p->hash_offset =0 ;for (i =0 ; i < params->n_args; i++) {char *arg_name = params->args_name[i];
@@ -171,6 +177,20 @@ pipeline_fc_parse_args(struct pipeline_flow_classification *p,continue ; } +/* key_mask */ +if (strcmp (arg_name,"key_mask" ) ==0 ) { +if (key_mask_present) +return -1 ; + + key_mask_str =strdup (arg_value); +if (key_mask_str ==NULL ) +return -1 ; + + key_mask_present =1 ; + +continue ; + } +/* hash_offset */ if (strcmp (arg_name,"hash_offset" ) ==0 ) {if (hash_offset_present)
@@ -189,10 +209,23 @@ pipeline_fc_parse_args(struct pipeline_flow_classification *p,/* Check that mandatory arguments are present */ if ((n_flows_present ==0 ) || (key_offset_present ==0 ) || - (key_size_present ==0 ) || - (hash_offset_present ==0 )) + (key_size_present ==0 ))return -1 ; +if (key_mask_present) { + p->key_mask =rte_malloc (NULL , p->key_size,0 ); +if (p->key_mask ==NULL ) +return -1 ; + +if (parse_hex_string (key_mask_str, p->key_mask, &p->key_size) + !=0 ) { +free (p->key_mask); +return -1 ; + } + +free (key_mask_str); + } +return 0 ; }
@@ -297,6 +330,7 @@ static void *pipeline_fc_init(struct pipeline_params *params, .signature_offset = p_fc->hash_offset, .key_offset = p_fc->key_offset, .f_hash = hash_func[(p_fc->key_size / 8) - 1], + .key_mask = p_fc->key_mask, .seed = 0, };
@@ -307,6 +341,7 @@ static void *pipeline_fc_init(struct pipeline_params *params, .signature_offset = p_fc->hash_offset, .key_offset = p_fc->key_offset, .f_hash = hash_func[(p_fc->key_size / 8) - 1], + .key_mask = p_fc->key_mask, .seed = 0, };
@@ -336,12 +371,25 @@ static void *pipeline_fc_init(struct pipeline_params *params,switch (p_fc->key_size) {case 8 : - table_params.ops = &rte_table_hash_key8_lru_ops; +if (p_fc->hash_offset !=0 ) { + table_params.ops = + &rte_table_hash_key8_ext_ops; + }else { + table_params.ops = + &rte_table_hash_key8_ext_dosig_ops; + } table_params.arg_create = &table_hash_key8_params;break ; +break ;case 16 : - table_params.ops = &rte_table_hash_key16_ext_ops; +if (p_fc->hash_offset !=0 ) { + table_params.ops = + &rte_table_hash_key16_ext_ops; + }else { + table_params.ops = + &rte_table_hash_key16_ext_dosig_ops; + } table_params.arg_create = &table_hash_key16_params;break ;
Signature · 1 line
2.1.0
PATCH v4 7/7 librte_table: performance improvement on rte_prefetch offset
In reply to [email protected]From: Fan Zhang <[email protected]>
This patch modifies rte_prefetch offsets to improve hash/lru table lookup performance.
--- lib/librte_table/rte_table_hash_ext.c | 10 ++++--- lib/librte_table/rte_table_hash_key16.c | 51 +++++++++++++++++---------------- lib/librte_table/rte_table_hash_key32.c | 35 +++++++++++----------- lib/librte_table/rte_table_hash_key8.c | 51 +++++++++++++++++---------------- lib/librte_table/rte_table_hash_lru.c | 10 ++++--- 5 files changed, 85 insertions(+), 72 deletions(-)
lib/librte_table/rte_table_hash_ext.c +6 -4
@@ -648,6 +648,7 @@ static int rte_table_hash_ext_lookup_unoptimized( { \uint64_t pkt00_mask, pkt01_mask; \struct rte_mbuf *mbuf00, *mbuf01; \ +uint32_t key_offset = t->key_offset; \ \ pkt00_index =__builtin_ctzll (pkts_mask); \ pkt00_mask =1LLU << pkt00_index; \
@@ -659,8 +660,8 @@ static int rte_table_hash_ext_lookup_unoptimized( pkts_mask &= ~pkt01_mask; \ mbuf01 = pkts[pkt01_index]; \ \ -rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf00,0 )); \ -rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf01,0 )); \ +rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf00, key_offset));\ +rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf01, key_offset));\ } #define lookup2_stage0_with_odd_support(t, g, pkts, pkts_mask, pkt00_index, \
@@ -668,6 +669,7 @@ static int rte_table_hash_ext_lookup_unoptimized( { \uint64_t pkt00_mask, pkt01_mask; \struct rte_mbuf *mbuf00, *mbuf01; \ +uint32_t key_offset = t->key_offset; \ \ pkt00_index =__builtin_ctzll (pkts_mask); \ pkt00_mask =1LLU << pkt00_index; \
@@ -681,8 +683,8 @@ static int rte_table_hash_ext_lookup_unoptimized( pkts_mask &= ~pkt01_mask; \ mbuf01 = pkts[pkt01_index]; \ \ -rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf00,0 )); \ -rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf01,0 )); \ +rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf00, key_offset));\ +rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf01, key_offset));\ }#define lookup2_stage1 (t, g, pkts, pkt10_index, pkt11_index) \
lib/librte_table/rte_table_hash_key16.c +27 -24
198 lines not on this page · raw message
lib/librte_table/rte_table_hash_key32.c +19 -16
@@ -591,16 +591,17 @@ rte_table_hash_entry_delete_key32_ext( pos =3 ; \ } -#define lookup1_stage0 (pkt0_index, mbuf0, pkts, pkts_mask) \ +#define lookup1_stage0 (pkt0_index, mbuf0, pkts, pkts_mask, f) \ { \ uint64_t pkt_mask; \ + uint32_t key_offset = f->key_offset; \ \ pkt0_index = __builtin_ctzll(pkts_mask); \ pkt_mask = 1LLU << pkt0_index; \ pkts_mask &= ~pkt_mask; \ \ mbuf0 = pkts[pkt0_index]; \ - rte_prefetch0(RTE_MBUF_METADATA_UINT8_PTR(mbuf0, 0)); \ + rte_prefetch0(RTE_MBUF_METADATA_UINT8_PTR(mbuf0, key_offset));\ }#define lookup1_stage1 (mbuf1, bucket1, f) \
@@ -698,36 +699,38 @@ rte_table_hash_entry_delete_key32_ext( }#define lookup2_stage0 (pkt00_index, pkt01_index, mbuf00, mbuf01,\ - pkts, pkts_mask) \ + pkts, pkts_mask, f) \ { \ uint64_t pkt00_mask, pkt01_mask; \ + uint32_t key_offset = f->key_offset; \ \ pkt00_index = __builtin_ctzll(pkts_mask); \ pkt00_mask = 1LLU << pkt00_index; \ pkts_mask &= ~pkt00_mask; \ \ mbuf00 = pkts[pkt00_index]; \ - rte_prefetch0(RTE_MBUF_METADATA_UINT8_PTR(mbuf00, 0)); \ + rte_prefetch0(RTE_MBUF_METADATA_UINT8_PTR(mbuf00, key_offset));\ \ pkt01_index = __builtin_ctzll(pkts_mask); \ pkt01_mask = 1LLU << pkt01_index; \ pkts_mask &= ~pkt01_mask; \ \ mbuf01 = pkts[pkt01_index]; \ - rte_prefetch0(RTE_MBUF_METADATA_UINT8_PTR(mbuf01, 0)); \ + rte_prefetch0(RTE_MBUF_METADATA_UINT8_PTR(mbuf01, key_offset));\ }#define lookup2_stage0_with_odd_support (pkt00_index, pkt01_index,\ - mbuf00, mbuf01, pkts, pkts_mask) \ + mbuf00, mbuf01, pkts, pkts_mask, f) \ { \ uint64_t pkt00_mask, pkt01_mask; \ + uint32_t key_offset = f->key_offset; \ \ pkt00_index = __builtin_ctzll(pkts_mask); \ pkt00_mask = 1LLU << pkt00_index; \ pkts_mask &= ~pkt00_mask; \ \ mbuf00 = pkts[pkt00_index]; \ - rte_prefetch0(RTE_MBUF_METADATA_UINT8_PTR(mbuf00, 0)); \ + rte_prefetch0(RTE_MBUF_METADATA_UINT8_PTR(mbuf00, key_offset)); \ \ pkt01_index = __builtin_ctzll(pkts_mask); \ if (pkts_mask == 0) \
@@ -737,7 +740,7 @@ rte_table_hash_entry_delete_key32_ext( pkts_mask &= ~pkt01_mask; \ \ mbuf01 = pkts[pkt01_index]; \ -rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf01,0 )); \ +rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf01, key_offset)); \ }#define lookup2_stage1 (mbuf10, mbuf11, bucket10, bucket11, f) \
@@ -852,7 +855,7 @@ rte_table_hash_lookup_key32_lru(struct rte_mbuf *mbuf;uint32_t pkt_index; -lookup1_stage0 (pkt_index, mbuf, pkts, pkts_mask); +lookup1_stage0 (pkt_index, mbuf, pkts, pkts_mask, f);lookup1_stage1 (mbuf, bucket, f);lookup1_stage2_lru (pkt_index, mbuf, bucket, pkts_mask_out, entries, f);
@@ -869,7 +872,7 @@ rte_table_hash_lookup_key32_lru(*/ /* Pipeline stage 0 */ lookup2_stage0 (pkt00_index, pkt01_index, mbuf00, mbuf01, pkts, - pkts_mask); + pkts_mask, f);/* Pipeline feed */ mbuf10 = mbuf00;
@@ -879,7 +882,7 @@ rte_table_hash_lookup_key32_lru(/* Pipeline stage 0 */ lookup2_stage0 (pkt00_index, pkt01_index, mbuf00, mbuf01, pkts, - pkts_mask); + pkts_mask, f);/* Pipeline stage 1 */ lookup2_stage1 (mbuf10, mbuf11, bucket10, bucket11, f);
@@ -903,7 +906,7 @@ rte_table_hash_lookup_key32_lru(/* Pipeline stage 0 */ lookup2_stage0_with_odd_support (pkt00_index, pkt01_index, - mbuf00, mbuf01, pkts, pkts_mask); + mbuf00, mbuf01, pkts, pkts_mask, f);/* Pipeline stage 1 */ lookup2_stage1 (mbuf10, mbuf11, bucket10, bucket11, f);
@@ -981,7 +984,7 @@ rte_table_hash_lookup_key32_ext(struct rte_mbuf *mbuf;uint32_t pkt_index; -lookup1_stage0 (pkt_index, mbuf, pkts, pkts_mask); +lookup1_stage0 (pkt_index, mbuf, pkts, pkts_mask, f);lookup1_stage1 (mbuf, bucket, f); lookup1_stage2_ext(pkt_index, mbuf, bucket, pkts_mask_out, entries, buckets_mask, buckets,
@@ -997,7 +1000,7 @@ rte_table_hash_lookup_key32_ext(*/ /* Pipeline stage 0 */ lookup2_stage0 (pkt00_index, pkt01_index, mbuf00, mbuf01, pkts, - pkts_mask); + pkts_mask, f);/* Pipeline feed */ mbuf10 = mbuf00;
@@ -1007,7 +1010,7 @@ rte_table_hash_lookup_key32_ext(/* Pipeline stage 0 */ lookup2_stage0 (pkt00_index, pkt01_index, mbuf00, mbuf01, pkts, - pkts_mask); + pkts_mask, f);/* Pipeline stage 1 */ lookup2_stage1 (mbuf10, mbuf11, bucket10, bucket11, f);
@@ -1031,7 +1034,7 @@ rte_table_hash_lookup_key32_ext(/* Pipeline stage 0 */ lookup2_stage0_with_odd_support (pkt00_index, pkt01_index, - mbuf00, mbuf01, pkts, pkts_mask); + mbuf00, mbuf01, pkts, pkts_mask, f);/* Pipeline stage 1 */ lookup2_stage1 (mbuf10, mbuf11, bucket10, bucket11, f);
lib/librte_table/rte_table_hash_key8.c +27 -24
198 lines not on this page · raw message
lib/librte_table/rte_table_hash_lru.c +6 -4
@@ -576,6 +576,7 @@ static int rte_table_hash_lru_lookup_unoptimized( { \uint64_t pkt00_mask, pkt01_mask; \struct rte_mbuf *mbuf00, *mbuf01; \ +uint32_t key_offset = t->key_offset; \ \ pkt00_index =__builtin_ctzll (pkts_mask); \ pkt00_mask =1LLU << pkt00_index; \
@@ -587,8 +588,8 @@ static int rte_table_hash_lru_lookup_unoptimized( pkts_mask &= ~pkt01_mask; \ mbuf01 = pkts[pkt01_index]; \ \ -rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf00,0 )); \ -rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf01,0 )); \ +rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf00, key_offset));\ +rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf01, key_offset));\ } #define lookup2_stage0_with_odd_support(t, g, pkts, pkts_mask, pkt00_index, \
@@ -596,6 +597,7 @@ static int rte_table_hash_lru_lookup_unoptimized( { \uint64_t pkt00_mask, pkt01_mask; \struct rte_mbuf *mbuf00, *mbuf01; \ +uint32_t key_offset = t->key_offset; \ \ pkt00_index =__builtin_ctzll (pkts_mask); \ pkt00_mask =1LLU << pkt00_index; \
@@ -610,8 +612,8 @@ static int rte_table_hash_lru_lookup_unoptimized( pkts_mask &= ~pkt01_mask; \ mbuf01 = pkts[pkt01_index]; \ \ -rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf00,0 )); \ -rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf01,0 )); \ +rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf00, key_offset));\ +rte_prefetch0 (RTE_MBUF_METADATA_UINT8_PTR (mbuf01, key_offset));\ }#define lookup2_stage1 (t, g, pkts, pkt10_index, pkt11_index) \
Signature · 1 line
2.1.0
Thomas Monjalon
Applied2015-10-28 17:11, [email protected]:
Quoted 15 lines
From: Fan Zhang <[email protected]>
This patchset links to ABI change announced for
librte_table. Thekey_maskparameters has been added to the hash table parameter structure for 8-byte key and 16-byte key extendible bucket and LRU tables.v2:
*updated release notev3:
*merged release note with source code patch
*fixed build error: added missing symbol to
librte_table/rte_table_version.map
Quoted 5 lines
v4:
*modifiedrte_prefetchoffsets to improve hash/lru table lookup performance.
Please put this line in each commit.
Quoted 9 lines
Fan Zhang (7):
librte_table: addkey_maskparameter to 8- and 16-bytes key hash
parameters
librte_table: add 16 byte hash table operations with computed lookup app/test: modify app/test_table_combined and app/test_table_tables app/test-pipeline: modify pipeline test example/ip_pipeline: addparse_hex_stringfor internal use example/ip_pipeline/pipeline: updateflow_classificationpipeline
librte_table: performance improvement onrte_prefetchoffset
Applied, thanks