[dpdk-dev] [PATCH v4 6/7] example/ip_pipeline/pipeline: update flow_classification pipeline
From: Fan Zhang <roy.fan.zh...@intel.com> 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. Signed-off-by: Fan Zhang --- .../pipeline/pipeline_flow_classification_be.c | 56 -- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c index 06a648d..e22f96f 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c @@ -37,6 +37,7 @@ #include #include #include +#include #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, >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 = _table_hash_key8_lru_ops; + if (p_fc->hash_offset != 0) { + table_params.ops = + _table_hash_key8_ext_ops; + } else { + table_params.ops = + _table_hash_key8_ext_dosig_ops; + } table_params.arg_create = _hash_key8_params; break; + break; case 16: - table_params.ops = _table_hash_key16_ext_ops; + if (p_fc->hash_offset != 0) { + table_params.ops = + _table_hash_key16_ext_ops; + } else { +
[dpdk-dev] [PATCH v4 2/7] librte_table: add 16 byte hash table operations with computed lookup
From: Fan Zhang <roy.fan.zh...@intel.com> This patch is to adding hash table operations for key signature computed on lookup ("do-sig") for LRU hash tables and Extendible buckets. Signed-off-by: Fan Zhang --- lib/librte_table/rte_table_hash.h | 8 + lib/librte_table/rte_table_hash_key16.c | 359 +++- 2 files changed, 364 insertions(+), 3 deletions(-) diff --git a/lib/librte_table/rte_table_hash.h b/lib/librte_table/rte_table_hash.h index e2c60e1..9d17516 100644 --- a/lib/librte_table/rte_table_hash.h +++ b/lib/librte_table/rte_table_hash.h @@ -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 * diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c index 0d6cc55..427b534 100644 --- a/lib/librte_table/rte_table_hash_key16.c +++ b/lib/librte_table/rte_table_hash_key16.c @@ -620,6 +620,27 @@ rte_table_hash_entry_delete_key16_ext( rte_prefetch0((void *)(((uintptr_t) bucket1) + RTE_CACHE_LINE_SIZE));\ } +#define lookup1_stage1_dosig(mbuf1, bucket1, f)\ +{ \ + uint64_t *key; \ + uint64_t signature = 0; \ + uint32_t bucket_index; \ + uint64_t hash_key_buffer[2];\ + \ + key = RTE_MBUF_METADATA_UINT64_PTR(mbuf1, f->key_offset);\ + \ + hash_key_buffer[0] = key[0] & f->key_mask[0]; \ + hash_key_buffer[1] = key[1] & f->key_mask[1]; \ + 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_16 *)\ + >memory[bucket_index * f->bucket_size]; \ + rte_prefetch0(bucket1); \ + rte_prefetch0((void *)(((uintptr_t) bucket1) + RTE_CACHE_LINE_SIZE));\ +} + #define lookup1_stage2_lru(pkt2_index, mbuf2, bucket2, \ pkts_mask_out, entries, f) \ { \ @@ -769,6 +790,36 @@ rte_table_hash_entry_delete_key16_ext( rte_prefetch0((void *)(((uintptr_t) bucket11) + RTE_CACHE_LINE_SIZE));\ } +#define lookup2_stage1_dosig(mbuf10, mbuf11, bucket10, bucket11, f)\ +{ \ + uint64_t *key10, *key11;\ + uint64_t hash_offset_buffer[2]; \ + uint64_t signature10, signature11; \ + uint32_t bucket10_index, bucket11_index;\ + \ + key10 = RTE_MBUF_METADATA_UINT64_PTR(mbuf10, f->key_offset);\ + hash_offset_buffer[0] = key10[0] & f->key_mask[0]; \ + hash_offset_buffer[1] = key10[1] & f->key_mask[1]; \ + signature10 = f->f_hash(hash_offset_buffer, \ + RTE_TABLE_HASH_KEY_SIZE, f->seed);\ + bucket10_index = signature10 & (f->n_buckets - 1); \ + bucket10 = (struct rte_bucket_4_16 *) \ + >memory[bucket10_index * f->bucket_size];\ + rte_prefetch0(bucket10);\ + rte_prefetch0((void *)(((uintptr_t) bucket10) + RTE_CACHE_LINE_SIZE));\ + \ + key11 = RTE_MBUF_METADATA_UINT64_PTR(mbuf11, f->key_offset);\ + hash_offset_buffer[0] = key11[0] & f->key_mask[0]; \ + hash_offset_buffer[1] = key11[1] & f->key_mask[1]; \ +
[dpdk-dev] [PATCH v4 1/7] librte_table: add key_mask parameter to 8- and 16-bytes key hash parameters
From: Fan Zhang <roy.fan.zh...@intel.com> 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. Signed-off-by: Fan Zhang Signed-off-by: Jasvinder Singh --- 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(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index a391ff0..16ec9f8 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -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 diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index 128f956..7beba40 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -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 --- diff --git a/lib/librte_table/rte_table_hash.h b/lib/librte_table/rte_table_hash.h index 9181942..e2c60e1 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 */ @@ -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 */ diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c index f6a3306..0d6cc55 100644 --- a/lib/librte_table/rte_table_hash_key16.c +++ b/lib/librte_table/rte_table_hash_key16.c @@ -85,6 +85,7 @@ struct rte_table_hash { uint32_t bucket_size; uint32_t signature_offset; uint32_t key_offset; + uint64_t key_mask[2]; rte_table_hash_op_hash f_hash; uint64_t seed; @@ -164,6 +165,14 @@ rte_table_hash_create_key16_lru(void *params, f->f_hash = p->f_hash; f->seed = p->seed; + if (p->key_mask != NULL) { + f->key_mask[0] = ((uint64_t *)p->key_mask)[0]; + f->key_mask[1] = ((uint64_t *)p->key_mask)[1]; + } else { + f->key_mask[0] = 0xLLU; + f->key_mask[1] = 0xLLU; + } + for (i = 0; i < n_buckets; i++) { struct rte_bucket_4_16 *bucket; @@ -384,6 +393,14 @@ rte_table_hash_create_key16_ext(void *params, for (i = 0; i < n_buckets_ext; i++) f->stack[i] = i; + if (p->key_mask != NULL) { + f->key_mask[0] = (((uint64_t *)p->key_mask)[0]); + f->key_mask[1] = (((uint64_t *)p->key_mask)[1]); + } else { + f->key_mask[0] = 0xF
[dpdk-dev] [PATCH v4 0/7] librte_table: add key_mask parameter to
From: Fan Zhang <roy.fan.zh...@intel.com> 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. Acked-by: Cristian Dumitrescu 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(-) -- 2.1.0
[dpdk-dev] [PATCH 8/8] librte_table: modify release notes and deprecation notice
From: Fan Zhang <roy.fan.zh...@intel.com> The LIBABIVER number is incremented. The release notes is updated and the deprecation announce is removed. Signed-off-by: Fan Zhang --- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_2_2.rst | 5 - lib/librte_table/Makefile| 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index fffad80..2b6954e 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -63,9 +63,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: diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index 9a70dae..a62f641 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -95,6 +95,9 @@ ABI Changes * The LPM structure is changed. The deprecated field mem_location is removed. +* Key mask parameter is added to the hash table parameter structure for + 8-byte key and 16-byte key extendible bucket and LRU tables. The + deprecated field mem_location is removed. Shared Library Versions --- @@ -127,6 +130,6 @@ The libraries prepended with a plus sign were incremented in this version. librte_reorder.so.1 librte_ring.so.1 librte_sched.so.1 - librte_table.so.1 + librte_table.so.2 librte_timer.so.1 librte_vhost.so.1 diff --git a/lib/librte_table/Makefile b/lib/librte_table/Makefile index c5b3eaf..7f02af3 100644 --- a/lib/librte_table/Makefile +++ b/lib/librte_table/Makefile @@ -41,7 +41,7 @@ CFLAGS += $(WERROR_FLAGS) EXPORT_MAP := rte_table_version.map -LIBABIVER := 1 +LIBABIVER := 2 # # all source are stored in SRCS-y -- 2.1.0
[dpdk-dev] [PATCH 7/8] example/ip_pipeline/pipeline: update flow_classification pipeline
From: Fan Zhang <roy.fan.zh...@intel.com> 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. Signed-off-by: Fan Zhang --- .../pipeline/pipeline_flow_classification_be.c | 56 -- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c index 06a648d..e22f96f 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c @@ -37,6 +37,7 @@ #include #include #include +#include #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, >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 = _table_hash_key8_lru_ops; + if (p_fc->hash_offset != 0) { + table_params.ops = + _table_hash_key8_ext_ops; + } else { + table_params.ops = + _table_hash_key8_ext_dosig_ops; + } table_params.arg_create = _hash_key8_params; break; + break; case 16: - table_params.ops = _table_hash_key16_ext_ops; + if (p_fc->hash_offset != 0) { + table_params.ops = + _table_hash_key16_ext_ops; + } else { +
[dpdk-dev] [PATCH 6/8] example/ip_pipeline: add parse_hex_string for internal use
From: Fan Zhang <roy.fan.zh...@intel.com> This patch adds parse_hex_string function to parse hex string to uint8_t array. Signed-off-by: Fan Zhang --- examples/ip_pipeline/config_parse.c | 70 + examples/ip_pipeline/pipeline.h | 4 +++ 2 files changed, 74 insertions(+) diff --git a/examples/ip_pipeline/config_parse.c b/examples/ip_pipeline/config_parse.c index c9b78f9..d7ee707 100644 --- a/examples/ip_pipeline/config_parse.c +++ b/examples/ip_pipeline/config_parse.c @@ -455,6 +455,76 @@ 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) { diff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h index b9a56ea..4063594 100644 --- a/examples/ip_pipeline/pipeline.h +++ b/examples/ip_pipeline/pipeline.h @@ -84,4 +84,8 @@ pipeline_type_cmds_count(struct pipeline_type *ptype) return n_cmds; } +/* Parse hex string to uint8_t array */ +int +parse_hex_string(char *src, uint8_t *dst, uint32_t *size); + #endif -- 2.1.0
[dpdk-dev] [PATCH 5/8] app/test-pipeline: modify pipeline test
From: Fan Zhang <roy.fan.zh...@intel.com> Test-pipeline have been updated to work on added key_mask parameter for 8-byte key extendible bucket and LRU tables. Signed-off-by: Fan Zhang --- app/test-pipeline/pipeline_hash.c | 4 1 file changed, 4 insertions(+) diff --git a/app/test-pipeline/pipeline_hash.c b/app/test-pipeline/pipeline_hash.c index 548615f..dda0d4d 100644 --- a/app/test-pipeline/pipeline_hash.c +++ b/app/test-pipeline/pipeline_hash.c @@ -216,6 +216,7 @@ app_main_loop_worker_pipeline_hash(void) { .n_entries_ext = 1 << 23, .signature_offset = 0, .key_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 = 0, .key_offset = 32, + .key_mask = NULL, .f_hash = test_hash, .seed = 0, }; @@ -267,6 +269,7 @@ app_main_loop_worker_pipeline_hash(void) { .key_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 = 32, .f_hash = test_hash, .seed = 0, + .key_mask = NULL }; struct rte_pipeline_table_params table_params = { -- 2.1.0
[dpdk-dev] [PATCH 4/8] app/test: modify app/test_table_combined and app/test_table_tables
From: Fan Zhang <roy.fan.zh...@intel.com> Tests have been updated to work on added key_mask parameter for 8-byte key extendible bucket and LRU tables. Signed-off-by: Fan Zhang --- app/test/test_table_combined.c | 4 app/test/test_table_tables.c | 6 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/test/test_table_combined.c b/app/test/test_table_combined.c index dd09da5..359ac45 100644 --- a/app/test/test_table_combined.c +++ b/app/test/test_table_combined.c @@ -419,6 +419,7 @@ test_table_hash8lru(void) .seed = 0, .signature_offset = 0, .key_offset = 32, + .key_mask = NULL, }; uint8_t key8lru[8]; @@ -477,6 +478,7 @@ test_table_hash16lru(void) .seed = 0, .signature_offset = 0, .key_offset = 32, + .key_mask = NULL, }; uint8_t key16lru[16]; @@ -594,6 +596,7 @@ test_table_hash8ext(void) .seed = 0, .signature_offset = 0, .key_offset = 32, + .key_mask = NULL, }; uint8_t key8ext[8]; @@ -660,6 +663,7 @@ test_table_hash16ext(void) .seed = 0, .signature_offset = 0, .key_offset = 32, + .key_mask = NULL, }; uint8_t key16ext[16]; diff --git a/app/test/test_table_tables.c b/app/test/test_table_tables.c index 566964b..cc222f1 100644 --- a/app/test/test_table_tables.c +++ b/app/test/test_table_tables.c @@ -651,7 +651,8 @@ test_table_hash_lru_generic(struct rte_table_ops *ops) .f_hash = pipeline_test_hash, .seed = 0, .signature_offset = 1, - .key_offset = 32 + .key_offset = 32, + .key_mask = NULL, }; hash_params.n_entries = 0; @@ -766,7 +767,8 @@ test_table_hash_ext_generic(struct rte_table_ops *ops) .f_hash = pipeline_test_hash, .seed = 0, .signature_offset = 1, - .key_offset = 32 + .key_offset = 32, + .key_mask = NULL, }; hash_params.n_entries = 0; -- 2.1.0
[dpdk-dev] [PATCH 3/8] librte_table: add 16 byte hash table operations with computed lookup
From: Fan Zhang <roy.fan.zh...@intel.com> This patch is to adding hash table operations for key signature computed on lookup ("do-sig") for LRU hash tables and Extendible buckets. Signed-off-by: Fan Zhang --- lib/librte_table/rte_table_hash.h | 8 + lib/librte_table/rte_table_hash_key16.c | 358 +++- 2 files changed, 363 insertions(+), 3 deletions(-) diff --git a/lib/librte_table/rte_table_hash.h b/lib/librte_table/rte_table_hash.h index e2c60e1..9d17516 100644 --- a/lib/librte_table/rte_table_hash.h +++ b/lib/librte_table/rte_table_hash.h @@ -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 * diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c index ffd3249..427b534 100644 --- a/lib/librte_table/rte_table_hash_key16.c +++ b/lib/librte_table/rte_table_hash_key16.c @@ -620,6 +620,27 @@ rte_table_hash_entry_delete_key16_ext( rte_prefetch0((void *)(((uintptr_t) bucket1) + RTE_CACHE_LINE_SIZE));\ } +#define lookup1_stage1_dosig(mbuf1, bucket1, f)\ +{ \ + uint64_t *key; \ + uint64_t signature = 0; \ + uint32_t bucket_index; \ + uint64_t hash_key_buffer[2];\ + \ + key = RTE_MBUF_METADATA_UINT64_PTR(mbuf1, f->key_offset);\ + \ + hash_key_buffer[0] = key[0] & f->key_mask[0]; \ + hash_key_buffer[1] = key[1] & f->key_mask[1]; \ + 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_16 *)\ + >memory[bucket_index * f->bucket_size]; \ + rte_prefetch0(bucket1); \ + rte_prefetch0((void *)(((uintptr_t) bucket1) + RTE_CACHE_LINE_SIZE));\ +} + #define lookup1_stage2_lru(pkt2_index, mbuf2, bucket2, \ pkts_mask_out, entries, f) \ { \ @@ -769,6 +790,36 @@ rte_table_hash_entry_delete_key16_ext( rte_prefetch0((void *)(((uintptr_t) bucket11) + RTE_CACHE_LINE_SIZE));\ } +#define lookup2_stage1_dosig(mbuf10, mbuf11, bucket10, bucket11, f)\ +{ \ + uint64_t *key10, *key11;\ + uint64_t hash_offset_buffer[2]; \ + uint64_t signature10, signature11; \ + uint32_t bucket10_index, bucket11_index;\ + \ + key10 = RTE_MBUF_METADATA_UINT64_PTR(mbuf10, f->key_offset);\ + hash_offset_buffer[0] = key10[0] & f->key_mask[0]; \ + hash_offset_buffer[1] = key10[1] & f->key_mask[1]; \ + signature10 = f->f_hash(hash_offset_buffer, \ + RTE_TABLE_HASH_KEY_SIZE, f->seed);\ + bucket10_index = signature10 & (f->n_buckets - 1); \ + bucket10 = (struct rte_bucket_4_16 *) \ + >memory[bucket10_index * f->bucket_size];\ + rte_prefetch0(bucket10);\ + rte_prefetch0((void *)(((uintptr_t) bucket10) + RTE_CACHE_LINE_SIZE));\ + \ + key11 = RTE_MBUF_METADATA_UINT64_PTR(mbuf11, f->key_offset);\ + hash_offset_buffer[0] = key11[0] & f->key_mask[0]; \ + hash_offset_buffer[1] = key11[1] & f->key_mask[1]; \ +
[dpdk-dev] [PATCH 2/8] librte_table: add key_mask parameter to 16-byte key hash parameters
From: Fan Zhang <roy.fan.zh...@intel.com> This patch relates to ABI change proposed for librte_table. key_mask parameter is added for 16-byte key extendible bucket and LRU tables. Signed-off-by: Fan Zhang --- lib/librte_table/rte_table_hash.h | 6 lib/librte_table/rte_table_hash_key16.c | 53 - 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/lib/librte_table/rte_table_hash.h b/lib/librte_table/rte_table_hash.h index ef65355..e2c60e1 100644 --- a/lib/librte_table/rte_table_hash.h +++ b/lib/librte_table/rte_table_hash.h @@ -263,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 */ @@ -290,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 */ diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c index f6a3306..ffd3249 100644 --- a/lib/librte_table/rte_table_hash_key16.c +++ b/lib/librte_table/rte_table_hash_key16.c @@ -85,6 +85,7 @@ struct rte_table_hash { uint32_t bucket_size; uint32_t signature_offset; uint32_t key_offset; + uint64_t key_mask[2]; rte_table_hash_op_hash f_hash; uint64_t seed; @@ -164,6 +165,14 @@ rte_table_hash_create_key16_lru(void *params, f->f_hash = p->f_hash; f->seed = p->seed; + if (p->key_mask != NULL) { + f->key_mask[0] = ((uint64_t *)p->key_mask)[0]; + f->key_mask[1] = ((uint64_t *)p->key_mask)[1]; + } else { + f->key_mask[0] = 0xLLU; + f->key_mask[1] = 0xLLU; + } + for (i = 0; i < n_buckets; i++) { struct rte_bucket_4_16 *bucket; @@ -384,6 +393,14 @@ rte_table_hash_create_key16_ext(void *params, for (i = 0; i < n_buckets_ext; i++) f->stack[i] = i; + if (p->key_mask != NULL) { + f->key_mask[0] = (((uint64_t *)p->key_mask)[0]); + f->key_mask[1] = (((uint64_t *)p->key_mask)[1]); + } else { + f->key_mask[0] = 0xLLU; + f->key_mask[1] = 0xLLU; + } + return f; } @@ -609,11 +626,14 @@ rte_table_hash_entry_delete_key16_ext( void *a;\ uint64_t pkt_mask; \ uint64_t *key; \ + uint64_t hash_key_buffer[2];\ uint32_t pos; \ \ key = RTE_MBUF_METADATA_UINT64_PTR(mbuf2, f->key_offset);\ + hash_key_buffer[0] = key[0] & f->key_mask[0]; \ + hash_key_buffer[1] = key[1] & f->key_mask[1]; \ \ - lookup_key16_cmp(key, bucket2, pos);\ + lookup_key16_cmp(hash_key_buffer, bucket2, pos);\ \ pkt_mask = (bucket2->signature[pos] & 1LLU) << pkt2_index;\ pkts_mask_out |= pkt_mask; \ @@ -631,11 +651,14 @@ rte_table_hash_entry_delete_key16_ext( void *a;\ uint64_t pkt_mask, bucket_mask; \ uint64_t *key; \ + uint64_t hash_key_buffer[2];\ uint32_t pos; \ \ key = RTE_MBUF_METADATA_UINT64_PTR(mbuf2, f->key_offset);\ + hash_key_buffer[0] = key[0] & f->key_mask[0]; \ + hash_key_buffer[1] = key[1] & f->key_mask[1]; \ \ - lookup_key16_cmp(key, bucket2, pos);\ + lookup_key16_cmp(hash_key_buffer, bucket2, pos);\ \ pkt_mask = (bucket2->signature[pos] & 1LLU) << pkt2_index;\ pkts_mask_out |= pkt_mask; \ @@ -658,12 +681,15 @@ rte_table_hash_entry_delete_key16_ext( void *a;\ uint64_t pk
[dpdk-dev] [PATCH 1/8] librte_table: add key_mask parameter to 8-byte key hash parameters
From: Fan Zhang <roy.fan.zh...@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 --- 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 = 0xLLU; + 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 *) >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 = 0xLLU; + 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(_key_buffer, \ + RTE_TABLE_HASH_KEY_SIZE, f->seed); \ bucket_index = signature & (f->n_buckets - 1); \ bucket1 = (struct rte_bucket_4_8 *) \ >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((_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 &
[dpdk-dev] [PATCH 0/8] librte_table: add key_mask parameter to 8-byte key
From: Fan Zhang <roy.fan.zh...@intel.com> This patchset links to ABI change announced for librte_table. 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. Fan Zhang (8): librte_table: add key_mask parameter to 8-byte key hash parameters librte_table: add key_mask parameter to 16-byte 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: modify release notes and deprecation notice app/test-pipeline/pipeline_hash.c | 4 + app/test/test_table_combined.c | 4 + app/test/test_table_tables.c | 6 +- doc/guides/rel_notes/deprecation.rst | 3 - doc/guides/rel_notes/release_2_2.rst | 5 +- examples/ip_pipeline/config_parse.c| 70 examples/ip_pipeline/pipeline.h| 4 + .../pipeline/pipeline_flow_classification_be.c | 56 ++- lib/librte_table/Makefile | 2 +- lib/librte_table/rte_table_hash.h | 20 + lib/librte_table/rte_table_hash_key16.c| 411 - lib/librte_table/rte_table_hash_key8.c | 54 ++- 12 files changed, 608 insertions(+), 31 deletions(-) -- 2.1.0
[dpdk-dev] [PATCH 4/4] librte_port: modify release notes and deprecation notice
From: Fan Zhang <roy.fan.zh...@intel.com> The LIBABIVER number is incremented. The release notes is updated and the deprecation announce is removed. Signed-off-by: Fan Zhang --- doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_2_2.rst | 4 +++- lib/librte_port/Makefile | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index fffad80..d08ba63 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -52,11 +52,6 @@ Deprecation Notices the value of macros CFG_NAME_LEN and CFG_NAME_VAL will be increased. Most likely, the new values will be 64 and 256, respectively. -* librte_port: Macros to access the packet meta-data stored within the - packet buffer will be adjusted to cover the packet mbuf structure as well, - as currently they are able to access any packet buffer location except the - packet mbuf structure. - * librte_table LPM: A new parameter to hold the table name will be added to the LPM table parameter structure. diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index 682f468..4d945db 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -47,6 +47,8 @@ ABI Changes * The LPM structure is changed. The deprecated field mem_location is removed. +* librte_port: Macros to access the packet meta-data stored within the packet + buffer has been adjusted to cover the packet mbuf structure. Shared Library Versions --- @@ -74,7 +76,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_pipeline.so.1 librte_pmd_bond.so.1 + librte_pmd_ring.so.2 - librte_port.so.1 + librte_port.so.2 librte_power.so.1 librte_reorder.so.1 librte_ring.so.1 diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile index ddbb383..410053e 100644 --- a/lib/librte_port/Makefile +++ b/lib/librte_port/Makefile @@ -41,7 +41,7 @@ CFLAGS += $(WERROR_FLAGS) EXPORT_MAP := rte_port_version.map -LIBABIVER := 1 +LIBABIVER := 2 # # all source are stored in SRCS-y -- 2.1.0
[dpdk-dev] [PATCH 3/4] app/test_pipeline: modify pipeline test
From: Fan Zhang <roy.fan.zh...@intel.com> Test_pipeline has been modified to work on updated macros to access meta-data stored in the mbuf structure. Signed-off-by: Fan Zhang --- app/test-pipeline/main.h | 2 ++ app/test-pipeline/pipeline_hash.c | 34 ++ app/test-pipeline/pipeline_lpm.c | 2 +- app/test-pipeline/pipeline_lpm_ipv6.c | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/test-pipeline/main.h b/app/test-pipeline/main.h index 0c90fc3..8dcd459 100644 --- a/app/test-pipeline/main.h +++ b/app/test-pipeline/main.h @@ -137,4 +137,6 @@ void app_main_loop_tx(void); #define APP_FLUSH 0x3FF #endif +#define APP_METADATA_OFFSET(offset) (sizeof(struct rte_mbuf) + (offset)) + #endif /* _MAIN_H_ */ diff --git a/app/test-pipeline/pipeline_hash.c b/app/test-pipeline/pipeline_hash.c index 548615f..5e4e17f 100644 --- a/app/test-pipeline/pipeline_hash.c +++ b/app/test-pipeline/pipeline_hash.c @@ -163,8 +163,8 @@ app_main_loop_worker_pipeline_hash(void) { .n_buckets_ext = 1 << 21, .f_hash = test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; struct rte_pipeline_table_params table_params = { @@ -214,8 +214,8 @@ app_main_loop_worker_pipeline_hash(void) { struct rte_table_hash_key8_ext_params table_hash_params = { .n_entries = 1 << 24, .n_entries_ext = 1 << 23, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), .f_hash = test_hash, .seed = 0, }; @@ -238,8 +238,8 @@ app_main_loop_worker_pipeline_hash(void) { { struct rte_table_hash_key8_lru_params table_hash_params = { .n_entries = 1 << 24, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), .f_hash = test_hash, .seed = 0, }; @@ -263,8 +263,8 @@ app_main_loop_worker_pipeline_hash(void) { struct rte_table_hash_key16_ext_params table_hash_params = { .n_entries = 1 << 24, .n_entries_ext = 1 << 23, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), .f_hash = test_hash, .seed = 0, }; @@ -287,8 +287,8 @@ app_main_loop_worker_pipeline_hash(void) { { struct rte_table_hash_key16_lru_params table_hash_params = { .n_entries = 1 << 24, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), .f_hash = test_hash, .seed = 0, }; @@ -312,8 +312,8 @@ app_main_loop_worker_pipeline_hash(void) { struct rte_table_hash_key32_ext_params table_hash_params = { .n_entries = 1 << 24, .n_entries_ext = 1 << 23, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), .f_hash = test_hash, .seed = 0, }; @@ -337,8 +337,8 @@ app_main_loop_worker_pipeline_hash(void) { { struct rte_table_hash_key32_lru_params table_hash_params = { .n_entries = 1 << 24, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), .f_hash = test_hash, .seed = 0, }; @@ -456,8 +456,10 @@ app_main_loop_rx_metadata(void) { m = app.mbuf_rx.array[j]; m_data = rte_pktmbuf_mtod(m, uint8_t *); - signature = RTE_MBUF_METADATA_UINT32_PTR(
[dpdk-dev] [PATCH 2/4] app/test: modify table and pipeline test
From: Fan Zhang <roy.fan.zh...@intel.com> Test_table has been modified to work on updated macros to access meta-data stored in the mbuf structure. Signed-off-by: Fan Zhang --- app/test/test_table.h | 8 ++-- app/test/test_table_combined.c | 28 +-- app/test/test_table_pipeline.c | 3 ++- app/test/test_table_tables.c | 44 ++ 4 files changed, 45 insertions(+), 38 deletions(-) diff --git a/app/test/test_table.h b/app/test/test_table.h index accc6f8..2077893 100644 --- a/app/test/test_table.h +++ b/app/test/test_table.h @@ -78,6 +78,8 @@ #define MP_FLAGS0 /* Macros */ +#define APP_METADATA_OFFSET(offset) (sizeof(struct rte_mbuf) + (offset)) + #define RING_ENQUEUE(ring, value) do { \ struct rte_mbuf *m; \ uint32_t *k32, *signature; \ @@ -86,8 +88,10 @@ m = rte_pktmbuf_alloc(pool);\ if (m == NULL) \ return -1; \ - signature = RTE_MBUF_METADATA_UINT32_PTR(m, 0); \ - key = RTE_MBUF_METADATA_UINT8_PTR(m, 32); \ + signature = RTE_MBUF_METADATA_UINT32_PTR(m, \ + APP_METADATA_OFFSET(0));\ + key = RTE_MBUF_METADATA_UINT8_PTR(m,\ + APP_METADATA_OFFSET(32)); \ k32 = (uint32_t *) key; \ k32[0] = (value); \ *signature = pipeline_test_hash(key, 0, 0); \ diff --git a/app/test/test_table_combined.c b/app/test/test_table_combined.c index dd09da5..5da005b 100644 --- a/app/test/test_table_combined.c +++ b/app/test/test_table_combined.c @@ -295,7 +295,7 @@ test_table_lpm_combined(void) struct rte_table_lpm_params lpm_params = { .n_rules = 1 << 16, .entry_unique_size = 8, - .offset = 0, + .offset = APP_METADATA_OFFSET(0), }; struct rte_table_lpm_key lpm_key = { @@ -355,7 +355,7 @@ test_table_lpm_ipv6_combined(void) .n_rules = 1 << 16, .number_tbl8s = 1 << 13, .entry_unique_size = 8, - .offset = 32, + .offset = APP_METADATA_OFFSET(32), }; struct rte_table_lpm_ipv6_key lpm_ipv6_key = { @@ -417,8 +417,8 @@ test_table_hash8lru(void) .n_entries = 1<<24, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key8lru[8]; @@ -475,8 +475,8 @@ test_table_hash16lru(void) .n_entries = 1<<16, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key16lru[16]; @@ -533,8 +533,8 @@ test_table_hash32lru(void) .n_entries = 1<<16, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key32lru[32]; @@ -592,8 +592,8 @@ test_table_hash8ext(void) .n_entries_ext = 1<<15, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key8ext[8]; @@ -658,8 +658,8 @@ test_table_hash16ext(void) .n_entries_ext = 1<<15, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADATA_OFFSET(32), }; uint8_t key16ext[16]; @@ -724,8 +724,8 @@ test_table_hash32ext(void) .n_entries_ext = 1<<15, .f_hash = pipeline_test_hash, .seed = 0, - .signature_offset = 0, - .key_offset = 32, + .signature_offset = APP_METADATA_OFFSET(0), + .key_offset = APP_METADAT
[dpdk-dev] [PATCH 1/4] librte_port: modify macros to access packet meta-data
From: Fan Zhang <roy.fan.zh...@intel.com> This patch relates to ABI change proposed for librte_port. Macros to access the packet meta-data stored within the packet buffer has been adjusted to cover the packet mbuf structure. Signed-off-by: Fan Zhang --- lib/librte_port/rte_port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_port/rte_port.h b/lib/librte_port/rte_port.h index 396c7e9..00b97a9 100644 --- a/lib/librte_port/rte_port.h +++ b/lib/librte_port/rte_port.h @@ -55,7 +55,7 @@ extern "C" { * just beyond the end of the mbuf data structure returned by a port */ #define RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset) \ - (&((uint8_t *) &(mbuf)[1])[offset]) + (&((uint8_t *)(mbuf))[offset]) #define RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset) \ ((uint16_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset)) #define RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset) \ -- 2.1.0
[dpdk-dev] [PATCH 0/4]librte_port: modify macros to access packet meta-data
From: Fan Zhang <roy.fan.zh...@intel.com> This patchset links to ABI change announced for librte_port. Macros to access the packet meta-data stored within the packet buffer has been adjusted to cover the packet mbuf structure. Fan Zhang (4): librte_port: modify macros to access packet meta-data app/test: modify table and pipeline test app/test_pipeline: modify pipeline test librte_port: modify release notes and deprecation notice app/test-pipeline/main.h | 2 ++ app/test-pipeline/pipeline_hash.c | 34 ++- app/test-pipeline/pipeline_lpm.c | 2 +- app/test-pipeline/pipeline_lpm_ipv6.c | 2 +- app/test/test_table.h | 8 +-- app/test/test_table_combined.c| 28 +++--- app/test/test_table_pipeline.c| 3 ++- app/test/test_table_tables.c | 44 ++- doc/guides/rel_notes/deprecation.rst | 5 doc/guides/rel_notes/release_2_2.rst | 4 +++- lib/librte_port/Makefile | 2 +- lib/librte_port/rte_port.h| 2 +- 12 files changed, 72 insertions(+), 64 deletions(-) -- 2.1.0