diff options
author | Luca Boccassi <luca.boccassi@gmail.com> | 2018-08-14 18:52:30 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2018-08-14 18:53:17 +0100 |
commit | b63264c8342e6a1b6971c79550d2af2024b6a4de (patch) | |
tree | 83114aac64286fe616506c0b3dfaec2ab86ef835 /lib/librte_table | |
parent | ca33590b6af032bff57d9cc70455660466a654b2 (diff) |
New upstream version 18.08upstream/18.08
Change-Id: I32fdf5e5016556d9c0a6d88ddaf1fc468961790a
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'lib/librte_table')
-rw-r--r-- | lib/librte_table/Makefile | 1 | ||||
-rw-r--r-- | lib/librte_table/meson.build | 37 | ||||
-rw-r--r-- | lib/librte_table/rte_table_acl.c | 6 | ||||
-rw-r--r-- | lib/librte_table/rte_table_hash.h | 3 | ||||
-rw-r--r-- | lib/librte_table/rte_table_hash_cuckoo.c | 11 | ||||
-rw-r--r-- | lib/librte_table/rte_table_hash_cuckoo.h | 57 |
6 files changed, 84 insertions, 31 deletions
diff --git a/lib/librte_table/Makefile b/lib/librte_table/Makefile index c4a9acb0..276d476a 100644 --- a/lib/librte_table/Makefile +++ b/lib/librte_table/Makefile @@ -45,6 +45,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_acl.h endif SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_hash.h +SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_hash_cuckoo.h SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_lru.h ifeq ($(CONFIG_RTE_ARCH_X86),y) SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_lru_x86.h diff --git a/lib/librte_table/meson.build b/lib/librte_table/meson.build index 13e797b4..8b2f8413 100644 --- a/lib/librte_table/meson.build +++ b/lib/librte_table/meson.build @@ -1,24 +1,29 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -version = 2 -sources = files('rte_table_lpm.c', 'rte_table_lpm_ipv6.c', - 'rte_table_hash_cuckoo.c', 'rte_table_hash_key8.c', - 'rte_table_hash_key16.c', 'rte_table_hash_key32.c', - 'rte_table_hash_ext.c', 'rte_table_hash_lru.c', - 'rte_table_array.c', 'rte_table_stub.c') -headers = files('rte_table.h', 'rte_table_lpm.h', - 'rte_table_lpm_ipv6.h', 'rte_table_hash.h', - 'rte_lru.h', 'rte_table_array.h', +version = 3 +sources = files('rte_table_acl.c', + 'rte_table_lpm.c', + 'rte_table_lpm_ipv6.c', + 'rte_table_hash_cuckoo.c', + 'rte_table_hash_key8.c', + 'rte_table_hash_key16.c', + 'rte_table_hash_key32.c', + 'rte_table_hash_ext.c', + 'rte_table_hash_lru.c', + 'rte_table_array.c', + 'rte_table_stub.c') +headers = files('rte_table.h', + 'rte_table_acl.h', + 'rte_table_lpm.h', + 'rte_table_lpm_ipv6.h', + 'rte_table_hash.h', + 'rte_table_hash_cuckoo.h', + 'rte_lru.h', + 'rte_table_array.h', 'rte_table_stub.h') -deps += ['mbuf', 'port', 'lpm', 'hash'] +deps += ['mbuf', 'port', 'lpm', 'hash', 'acl'] if arch_subdir == 'x86' headers += files('rte_lru_x86.h') endif - -if dpdk_conf.has('RTE_LIBRTE_ACL') - sources += files('rte_table_acl.c') - headers += files('rte_table_acl.h') - deps += ['acl'] -endif diff --git a/lib/librte_table/rte_table_acl.c b/lib/librte_table/rte_table_acl.c index 73d3910e..14d54019 100644 --- a/lib/librte_table/rte_table_acl.c +++ b/lib/librte_table/rte_table_acl.c @@ -472,12 +472,6 @@ rte_table_acl_entry_add_bulk( return -EINVAL; } - if (entries_ptr[i] == NULL) { - RTE_LOG(ERR, TABLE, "%s: entries_ptr[%" PRIu32 "] parameter is NULL\n", - __func__, i); - return -EINVAL; - } - rule = keys[i]; if (rule->priority > RTE_ACL_MAX_PRIORITY) { RTE_LOG(ERR, TABLE, "%s: Priority is too high\n", __func__); diff --git a/lib/librte_table/rte_table_hash.h b/lib/librte_table/rte_table_hash.h index 7aad84fa..6f55bd57 100644 --- a/lib/librte_table/rte_table_hash.h +++ b/lib/librte_table/rte_table_hash.h @@ -99,9 +99,6 @@ extern struct rte_table_ops rte_table_hash_key8_lru_ops; extern struct rte_table_ops rte_table_hash_key16_lru_ops; extern struct rte_table_ops rte_table_hash_key32_lru_ops; -/** Cuckoo hash table operations */ -extern struct rte_table_ops rte_table_hash_cuckoo_ops; - #ifdef __cplusplus } #endif diff --git a/lib/librte_table/rte_table_hash_cuckoo.c b/lib/librte_table/rte_table_hash_cuckoo.c index dcb4fe97..f0243033 100644 --- a/lib/librte_table/rte_table_hash_cuckoo.c +++ b/lib/librte_table/rte_table_hash_cuckoo.c @@ -10,8 +10,7 @@ #include <rte_malloc.h> #include <rte_log.h> -#include <rte_hash.h> -#include "rte_table_hash.h" +#include "rte_table_hash_cuckoo.h" #ifdef RTE_TABLE_STATS_COLLECT @@ -35,7 +34,7 @@ struct rte_table_hash { uint32_t key_size; uint32_t entry_size; uint32_t n_keys; - rte_table_hash_op_hash f_hash; + rte_hash_function f_hash; uint32_t seed; uint32_t key_offset; @@ -47,7 +46,7 @@ struct rte_table_hash { }; static int -check_params_create_hash_cuckoo(struct rte_table_hash_params *params) +check_params_create_hash_cuckoo(struct rte_table_hash_cuckoo_params *params) { if (params == NULL) { RTE_LOG(ERR, TABLE, "NULL Input Parameters.\n"); @@ -82,7 +81,7 @@ rte_table_hash_cuckoo_create(void *params, int socket_id, uint32_t entry_size) { - struct rte_table_hash_params *p = params; + struct rte_table_hash_cuckoo_params *p = params; struct rte_hash *h_table; struct rte_table_hash *t; uint32_t total_size; @@ -107,7 +106,7 @@ rte_table_hash_cuckoo_create(void *params, struct rte_hash_parameters hash_cuckoo_params = { .entries = p->n_keys, .key_len = p->key_size, - .hash_func = (rte_hash_function)(p->f_hash), + .hash_func = p->f_hash, .hash_func_init_val = p->seed, .socket_id = socket_id, .name = p->name diff --git a/lib/librte_table/rte_table_hash_cuckoo.h b/lib/librte_table/rte_table_hash_cuckoo.h new file mode 100644 index 00000000..d9d43121 --- /dev/null +++ b/lib/librte_table/rte_table_hash_cuckoo.h @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Intel Corporation + */ + +#ifndef __INCLUDE_RTE_TABLE_HASH_CUCKOO_H__ +#define __INCLUDE_RTE_TABLE_HASH_CUCKOO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file + * RTE Table Hash Cuckoo + * + ***/ +#include <stdint.h> + +#include <rte_hash.h> + +#include "rte_table.h" + +/** Hash table parameters */ +struct rte_table_hash_cuckoo_params { + /** Name */ + const char *name; + + /** Key size (number of bytes) */ + uint32_t key_size; + + /** Byte offset within packet meta-data where the key is located */ + uint32_t key_offset; + + /** Key mask */ + uint8_t *key_mask; + + /** Number of keys */ + uint32_t n_keys; + + /** Number of buckets */ + uint32_t n_buckets; + + /** Hash function */ + rte_hash_function f_hash; + + /** Seed value for the hash function */ + uint32_t seed; +}; + +/** Cuckoo hash table operations */ +extern struct rte_table_ops rte_table_hash_cuckoo_ops; + +#ifdef __cplusplus +} +#endif + +#endif |