Add unified parameter structure for all hash tables in librte_table.
Add mask-based hash function prototype, which is input parameter for
all hash tables.
Renamed the non-mask-based hash function prototype and all the calls
to it (to be removed later).
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
uint32_t pad;
};
-rte_table_hash_op_hash hash_func[] = {
+rte_table_hash_op_hash_nomask hash_func[] = {
hash_default_key8,
hash_default_key16,
hash_default_key24,
struct pipeline_passthrough {
struct pipeline p;
struct pipeline_passthrough_params params;
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
uint32_t swap_field0_offset[SWAP_DIM];
uint32_t swap_field1_offset[SWAP_DIM];
uint64_t swap_field_mask[SWAP_DIM];
return 0;
}
-static rte_table_hash_op_hash
+static rte_table_hash_op_hash_nomask
get_hash_function(struct pipeline_passthrough *p)
{
switch (p->params.dma_size) {
/** Hash function */
typedef uint64_t (*rte_table_hash_op_hash)(
+ void *key,
+ void *key_mask,
+ uint32_t key_size,
+ uint64_t seed);
+
+/** Hash table parameters */
+struct rte_table_hash_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_table_hash_op_hash f_hash;
+
+ /** Seed value for the hash function */
+ uint64_t seed;
+};
+
+/** Hash function */
+typedef uint64_t (*rte_table_hash_op_hash_nomask)(
void *key,
uint32_t key_size,
uint64_t seed);
uint32_t n_buckets_ext;
/** Hash function */
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
/** Seed value for the hash function */
uint64_t seed;
uint32_t n_buckets;
/** Hash function */
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
/** Seed value for the hash function */
uint64_t seed;
uint32_t n_entries;
/** Hash function */
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
/** Seed for the hash function */
uint64_t seed;
uint32_t n_entries_ext;
/** Hash function */
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
/** Seed for the hash function */
uint64_t seed;
uint32_t n_entries;
/** Hash function */
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
/** Seed for the hash function */
uint64_t seed;
uint32_t n_entries_ext;
/** Hash function */
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
/** Seed for the hash function */
uint64_t seed;
uint32_t n_entries;
/** Hash function */
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
/** Seed for the hash function */
uint64_t seed;
uint32_t n_entries_ext;
/** Hash function */
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
/** Seed for the hash function */
uint64_t seed;
uint32_t n_keys;
/** Hash function used to calculate hash */
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
/** Seed value or Init value used by f_hash */
uint32_t seed;
uint32_t key_size;
uint32_t entry_size;
uint32_t n_keys;
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
uint32_t seed;
uint32_t signature_offset;
uint32_t key_offset;
uint32_t n_keys;
uint32_t n_buckets;
uint32_t n_buckets_ext;
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
uint64_t seed;
uint32_t signature_offset;
uint32_t key_offset;
struct bucket *bkt10, *bkt11, *buckets = t->buckets; \
uint8_t *key10, *key11; \
uint64_t bucket_mask = t->bucket_mask; \
- rte_table_hash_op_hash f_hash = t->f_hash; \
+ rte_table_hash_op_hash_nomask f_hash = t->f_hash; \
uint64_t seed = t->seed; \
uint32_t key_size = t->key_size; \
uint32_t key_offset = t->key_offset; \
uint32_t signature_offset;
uint32_t key_offset;
uint64_t key_mask[2];
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
uint64_t seed;
/* Extendible buckets */
uint32_t bucket_size;
uint32_t signature_offset;
uint32_t key_offset;
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
uint64_t seed;
/* Extendible buckets */
uint32_t signature_offset;
uint32_t key_offset;
uint64_t key_mask;
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
uint64_t seed;
/* Extendible buckets */
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; \
+ rte_table_hash_op_hash_nomask f_hash = f->f_hash; \
uint64_t seed = f->seed; \
uint32_t key_offset = f->key_offset; \
\
uint32_t entry_size;
uint32_t n_keys;
uint32_t n_buckets;
- rte_table_hash_op_hash f_hash;
+ rte_table_hash_op_hash_nomask f_hash;
uint64_t seed;
uint32_t signature_offset;
uint32_t key_offset;
struct bucket *bkt10, *bkt11, *buckets = t->buckets; \
uint8_t *key10, *key11; \
uint64_t bucket_mask = t->bucket_mask; \
- rte_table_hash_op_hash f_hash = t->f_hash; \
+ rte_table_hash_op_hash_nomask f_hash = t->f_hash; \
uint64_t seed = t->seed; \
uint32_t key_size = t->key_size; \
uint32_t key_offset = t->key_offset; \