Introduce mask-based hash functions in hash_func.h.
Propagate their usage in test/test, test/test-pipeline and
examples/ip_pipeline.
Remove the non-mask-based hash function prototype from API (which
was previously used as build workaround).
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
#define __INCLUDE_HASH_FUNC_H__
static inline uint64_t
-hash_xor_key8(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_xor_key8(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t xor0;
- xor0 = seed ^ k[0];
+ xor0 = seed ^ (k[0] & m[0]);
return (xor0 >> 32) ^ xor0;
}
static inline uint64_t
-hash_xor_key16(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_xor_key16(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t xor0;
- xor0 = (k[0] ^ seed) ^ k[1];
+ xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
return (xor0 >> 32) ^ xor0;
}
static inline uint64_t
-hash_xor_key24(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_xor_key24(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t xor0;
- xor0 = (k[0] ^ seed) ^ k[1];
+ xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
- xor0 ^= k[2];
+ xor0 ^= k[2] & m[2];
return (xor0 >> 32) ^ xor0;
}
static inline uint64_t
-hash_xor_key32(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_xor_key32(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t xor0, xor1;
- xor0 = (k[0] ^ seed) ^ k[1];
- xor1 = k[2] ^ k[3];
+ xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
+ xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
xor0 ^= xor1;
}
static inline uint64_t
-hash_xor_key40(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_xor_key40(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t xor0, xor1;
- xor0 = (k[0] ^ seed) ^ k[1];
- xor1 = k[2] ^ k[3];
+ xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
+ xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
xor0 ^= xor1;
- xor0 ^= k[4];
+ xor0 ^= k[4] & m[4];
return (xor0 >> 32) ^ xor0;
}
static inline uint64_t
-hash_xor_key48(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_xor_key48(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t xor0, xor1, xor2;
- xor0 = (k[0] ^ seed) ^ k[1];
- xor1 = k[2] ^ k[3];
- xor2 = k[4] ^ k[5];
+ xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
+ xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
+ xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
xor0 ^= xor1;
}
static inline uint64_t
-hash_xor_key56(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_xor_key56(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t xor0, xor1, xor2;
- xor0 = (k[0] ^ seed) ^ k[1];
- xor1 = k[2] ^ k[3];
- xor2 = k[4] ^ k[5];
+ xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
+ xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
+ xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
xor0 ^= xor1;
- xor2 ^= k[6];
+ xor2 ^= k[6] & m[6];
xor0 ^= xor2;
}
static inline uint64_t
-hash_xor_key64(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_xor_key64(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t xor0, xor1, xor2, xor3;
- xor0 = (k[0] ^ seed) ^ k[1];
- xor1 = k[2] ^ k[3];
- xor2 = k[4] ^ k[5];
- xor3 = k[6] ^ k[7];
+ xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
+ xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
+ xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
+ xor3 = (k[6] & m[6]) ^ (k[7] & m[7]);
xor0 ^= xor1;
xor2 ^= xor3;
#include <x86intrin.h>
static inline uint64_t
-hash_crc_key8(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_crc_key8(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t crc0;
- crc0 = _mm_crc32_u64(seed, k[0]);
+ crc0 = _mm_crc32_u64(seed, k[0] & m[0]);
return crc0;
}
static inline uint64_t
-hash_crc_key16(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_crc_key16(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t k0, crc0, crc1;
- k0 = k[0];
+ k0 = k[0] & m[0];
crc0 = _mm_crc32_u64(k0, seed);
- crc1 = _mm_crc32_u64(k0 >> 32, k[1]);
+ crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
crc0 ^= crc1;
}
static inline uint64_t
-hash_crc_key24(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_crc_key24(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t k0, k2, crc0, crc1;
- k0 = k[0];
- k2 = k[2];
+ k0 = k[0] & m[0];
+ k2 = k[2] & m[2];
crc0 = _mm_crc32_u64(k0, seed);
- crc1 = _mm_crc32_u64(k0 >> 32, k[1]);
+ crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
crc0 = _mm_crc32_u64(crc0, k2);
}
static inline uint64_t
-hash_crc_key32(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_crc_key32(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t k0, k2, crc0, crc1, crc2, crc3;
- k0 = k[0];
- k2 = k[2];
+ k0 = k[0] & m[0];
+ k2 = k[2] & m[2];
crc0 = _mm_crc32_u64(k0, seed);
- crc1 = _mm_crc32_u64(k0 >> 32, k[1]);
+ crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
- crc2 = _mm_crc32_u64(k2, k[3]);
+ crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
crc3 = k2 >> 32;
crc0 = _mm_crc32_u64(crc0, crc1);
}
static inline uint64_t
-hash_crc_key40(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_crc_key40(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t k0, k2, crc0, crc1, crc2, crc3;
- k0 = k[0];
- k2 = k[2];
+ k0 = k[0] & m[0];
+ k2 = k[2] & m[2];
crc0 = _mm_crc32_u64(k0, seed);
- crc1 = _mm_crc32_u64(k0 >> 32, k[1]);
+ crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
- crc2 = _mm_crc32_u64(k2, k[3]);
- crc3 = _mm_crc32_u64(k2 >> 32, k[4]);
+ crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
+ crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
crc0 = _mm_crc32_u64(crc0, crc1);
crc1 = _mm_crc32_u64(crc2, crc3);
}
static inline uint64_t
-hash_crc_key48(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_crc_key48(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t k0, k2, k5, crc0, crc1, crc2, crc3;
- k0 = k[0];
- k2 = k[2];
- k5 = k[5];
+ k0 = k[0] & m[0];
+ k2 = k[2] & m[2];
+ k5 = k[5] & m[5];
crc0 = _mm_crc32_u64(k0, seed);
- crc1 = _mm_crc32_u64(k0 >> 32, k[1]);
+ crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
- crc2 = _mm_crc32_u64(k2, k[3]);
- crc3 = _mm_crc32_u64(k2 >> 32, k[4]);
+ crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
+ crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
crc1 = _mm_crc32_u64(crc3, k5);
}
static inline uint64_t
-hash_crc_key56(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_crc_key56(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5;
- k0 = k[0];
- k2 = k[2];
- k5 = k[5];
+ k0 = k[0] & m[0];
+ k2 = k[2] & m[2];
+ k5 = k[5] & m[5];
crc0 = _mm_crc32_u64(k0, seed);
- crc1 = _mm_crc32_u64(k0 >> 32, k[1]);
+ crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
- crc2 = _mm_crc32_u64(k2, k[3]);
- crc3 = _mm_crc32_u64(k2 >> 32, k[4]);
+ crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
+ crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
- crc4 = _mm_crc32_u64(k5, k[6]);
+ crc4 = _mm_crc32_u64(k5, k[6] & m[6]);
crc5 = k5 >> 32;
crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
}
static inline uint64_t
-hash_crc_key64(void *key, __rte_unused uint32_t key_size, uint64_t seed)
+hash_crc_key64(void *key, void *mask, __rte_unused uint32_t key_size,
+ uint64_t seed)
{
uint64_t *k = key;
+ uint64_t *m = mask;
uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5;
- k0 = k[0];
- k2 = k[2];
- k5 = k[5];
+ k0 = k[0] & m[0];
+ k2 = k[2] & m[2];
+ k5 = k[5] & m[5];
crc0 = _mm_crc32_u64(k0, seed);
- crc1 = _mm_crc32_u64(k0 >> 32, k[1]);
+ crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
- crc2 = _mm_crc32_u64(k2, k[3]);
- crc3 = _mm_crc32_u64(k2 >> 32, k[4]);
+ crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
+ crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
- crc4 = _mm_crc32_u64(k5, k[6]);
- crc5 = _mm_crc32_u64(k5 >> 32, k[7]);
+ crc4 = _mm_crc32_u64(k5, k[6] & m[6]);
+ crc5 = _mm_crc32_u64(k5 >> 32, k[7] & m[7]);
crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
crc1 = _mm_crc32_u64(crc3, (crc4 << 32) ^ crc5);
uint32_t *signature)
{
uint8_t buffer[PIPELINE_FC_FLOW_KEY_MAX_SIZE];
+ uint8_t m[PIPELINE_FC_FLOW_KEY_MAX_SIZE]; /* key mask */
void *key_buffer = (key_out) ? key_out : buffer;
+ memset(m, 0xFF, sizeof(m));
switch (key_in->type) {
case FLOW_KEY_QINQ:
{
qinq->cvlan = rte_cpu_to_be_16(key_in->key.qinq.cvlan);
if (signature)
- *signature = (uint32_t) hash_default_key8(qinq, 8, 0);
+ *signature = (uint32_t) hash_default_key8(qinq, m, 8, 0);
return 0;
}
ipv4->port_dst = rte_cpu_to_be_16(key_in->key.ipv4_5tuple.port_dst);
if (signature)
- *signature = (uint32_t) hash_default_key16(ipv4, 16, 0);
+ *signature = (uint32_t) hash_default_key16(ipv4, m, 16, 0);
return 0;
}
ipv6->port_dst = rte_cpu_to_be_16(key_in->key.ipv6_5tuple.port_dst);
if (signature)
- *signature = (uint32_t) hash_default_key64(ipv6, 64, 0);
+ *signature = (uint32_t) hash_default_key64(ipv6, m, 64, 0);
return 0;
}
}
/* Free resources */
- app_msg_free(app, rsp);
for (i = rsp->n_keys; i < n_keys; i++)
if (new_flow[i])
rte_free(flow[i]);
+ app_msg_free(app, rsp);
rte_free(flow_rsp);
rte_free(flow_req);
rte_free(new_flow);
uint32_t pad;
};
-rte_table_hash_op_hash_nomask hash_func[] = {
+rte_table_hash_op_hash hash_func[] = {
hash_default_key8,
hash_default_key16,
hash_default_key24,
p_fc->key_mask : NULL,
.n_keys = p_fc->n_flows,
.n_buckets = p_fc->n_flows / 4,
- .f_hash = (rte_table_hash_op_hash)hash_func[(p_fc->key_size / 8) - 1],
+ .f_hash = hash_func[(p_fc->key_size / 8) - 1],
.seed = 0,
};
switch (p_fc->key_size) {
case 8:
table_params.ops = &rte_table_hash_key8_ext_ops;
- table_params.arg_create = &table_hash_params;
break;
case 16:
table_params.ops = &rte_table_hash_key16_ext_ops;
- table_params.arg_create = &table_hash_params;
break;
default:
table_params.ops = &rte_table_hash_ext_ops;
- table_params.arg_create = &table_hash_params;
}
+ table_params.arg_create = &table_hash_params;
+
status = rte_pipeline_table_create(p->p,
&table_params,
&p->table_id[0]);
struct pipeline_passthrough {
struct pipeline p;
struct pipeline_passthrough_params params;
- rte_table_hash_op_hash_nomask f_hash;
+ rte_table_hash_op_hash f_hash;
uint32_t swap_field0_offset[SWAP_DIM];
uint32_t swap_field1_offset[SWAP_DIM];
uint64_t swap_field_mask[SWAP_DIM];
/* Read (dma_dst), compute (hash), write (hash) */
if (hash_enabled) {
- uint32_t hash = p->f_hash(dma_dst, dma_size, 0);
+ uint32_t hash = p->f_hash(dma_src, dma_mask, dma_size, 0);
*dma_hash = hash;
if (lb_hash) {
/* Read (dma_dst), compute (hash), write (hash) */
if (hash_enabled) {
- uint32_t hash0 = p->f_hash(dma_dst0, dma_size, 0);
- uint32_t hash1 = p->f_hash(dma_dst1, dma_size, 0);
- uint32_t hash2 = p->f_hash(dma_dst2, dma_size, 0);
- uint32_t hash3 = p->f_hash(dma_dst3, dma_size, 0);
+ uint32_t hash0 = p->f_hash(dma_src0, dma_mask, dma_size, 0);
+ uint32_t hash1 = p->f_hash(dma_src1, dma_mask, dma_size, 0);
+ uint32_t hash2 = p->f_hash(dma_src2, dma_mask, dma_size, 0);
+ uint32_t hash3 = p->f_hash(dma_src3, dma_mask, dma_size, 0);
*dma_hash0 = hash0;
*dma_hash1 = hash1;
return 0;
}
-static rte_table_hash_op_hash_nomask
+static rte_table_hash_op_hash
get_hash_function(struct pipeline_passthrough *p)
{
switch (p->params.dma_size) {
.key_mask = NULL,
.n_keys = p_rt->params.n_arp_entries,
.n_buckets = p_rt->params.n_arp_entries / 4,
- .f_hash = (rte_table_hash_op_hash)hash_default_key8,
+ .f_hash = hash_default_key8,
.seed = 0,
};
uint64_t seed;
};
-/** Hash function */
-typedef uint64_t (*rte_table_hash_op_hash_nomask)(
- void *key,
- uint32_t key_size,
- uint64_t seed);
-
extern struct rte_table_ops rte_table_hash_ext_ops;
extern struct rte_table_ops rte_table_hash_lru_ops;
void app_main_loop_rx(void);
void app_main_loop_rx_metadata(void);
-uint64_t test_hash(void *key, uint32_t key_size, uint64_t seed);
+uint64_t test_hash(void *key,
+ void *key_mask,
+ uint32_t key_size,
+ uint64_t seed);
void app_main_loop_worker(void);
void app_main_loop_worker_pipeline_stub(void);
"ring %d\n", i);
}
+ struct rte_table_hash_params table_hash_params = {
+ .name = "TABLE",
+ .key_size = key_size,
+ .key_offset = APP_METADATA_OFFSET(32),
+ .key_mask = NULL,
+ .n_keys = 1 << 24,
+ .n_buckets = 1 << 22,
+ .f_hash = test_hash,
+ .seed = 0,
+ };
+
/* Table configuration */
switch (app.pipeline_type) {
case e_APP_PIPELINE_HASH_KEY8_EXT:
case e_APP_PIPELINE_HASH_KEY16_EXT:
case e_APP_PIPELINE_HASH_KEY32_EXT:
{
- struct rte_table_hash_params table_hash_params = {
- .name = "TABLE",
- .key_size = key_size,
- .key_offset = APP_METADATA_OFFSET(32),
- .key_mask = NULL,
- .n_keys = 1 << 24,
- .n_buckets = 1 << 22,
- .f_hash = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_ext_ops,
.arg_create = &table_hash_params,
case e_APP_PIPELINE_HASH_KEY16_LRU:
case e_APP_PIPELINE_HASH_KEY32_LRU:
{
- struct rte_table_hash_params table_hash_params = {
- .name = "TABLE",
- .key_size = key_size,
- .key_offset = APP_METADATA_OFFSET(32),
- .key_mask = NULL,
- .n_keys = 1 << 24,
- .n_buckets = 1 << 22,
- .f_hash = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_lru_ops,
.arg_create = &table_hash_params,
case e_APP_PIPELINE_HASH_SPEC_KEY8_EXT:
{
- struct rte_table_hash_params table_hash_params = {
- .name = "TABLE",
- .key_size = key_size,
- .key_offset = APP_METADATA_OFFSET(32),
- .key_mask = NULL,
- .n_keys = 1 << 24,
- .n_buckets = 1 << 22,
- .f_hash = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key8_ext_ops,
.arg_create = &table_hash_params,
case e_APP_PIPELINE_HASH_SPEC_KEY8_LRU:
{
- struct rte_table_hash_params table_hash_params = {
- .name = "TABLE",
- .key_size = key_size,
- .key_offset = APP_METADATA_OFFSET(32),
- .key_mask = NULL,
- .n_keys = 1 << 24,
- .n_buckets = 1 << 22,
- .f_hash = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key8_lru_ops,
.arg_create = &table_hash_params,
case e_APP_PIPELINE_HASH_SPEC_KEY16_EXT:
{
- struct rte_table_hash_params table_hash_params = {
- .name = "TABLE",
- .key_size = key_size,
- .key_offset = APP_METADATA_OFFSET(32),
- .key_mask = NULL,
- .n_keys = 1 << 24,
- .n_buckets = 1 << 22,
- .f_hash = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key16_ext_ops,
.arg_create = &table_hash_params,
case e_APP_PIPELINE_HASH_SPEC_KEY16_LRU:
{
- struct rte_table_hash_params table_hash_params = {
- .name = "TABLE",
- .key_size = key_size,
- .key_offset = APP_METADATA_OFFSET(32),
- .key_mask = NULL,
- .n_keys = 1 << 24,
- .n_buckets = 1 << 22,
- .f_hash = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key16_lru_ops,
.arg_create = &table_hash_params,
case e_APP_PIPELINE_HASH_SPEC_KEY32_EXT:
{
- struct rte_table_hash_params table_hash_params = {
- .name = "TABLE",
- .key_size = key_size,
- .key_offset = APP_METADATA_OFFSET(32),
- .key_mask = NULL,
- .n_keys = 1 << 24,
- .n_buckets = 1 << 22,
- .f_hash = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key32_ext_ops,
.arg_create = &table_hash_params,
case e_APP_PIPELINE_HASH_SPEC_KEY32_LRU:
{
- struct rte_table_hash_params table_hash_params = {
- .name = "TABLE",
- .key_size = key_size,
- .key_offset = APP_METADATA_OFFSET(32),
- .key_mask = NULL,
- .n_keys = 1 << 24,
- .n_buckets = 1 << 22,
- .f_hash = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_key32_lru_ops,
.arg_create = &table_hash_params,
case e_APP_PIPELINE_HASH_CUCKOO_KEY112:
case e_APP_PIPELINE_HASH_CUCKOO_KEY128:
{
- struct rte_table_hash_params table_hash_params = {
- .name = "TABLE",
- .key_size = key_size,
- .key_offset = APP_METADATA_OFFSET(32),
- .key_mask = NULL,
- .n_keys = 1 << 24,
- .n_buckets = 1 << 22,
- .f_hash = (rte_table_hash_op_hash)test_hash,
- .seed = 0,
- };
-
struct rte_pipeline_table_params table_params = {
.ops = &rte_table_hash_cuckoo_ops,
.arg_create = &table_hash_params,
uint64_t test_hash(
void *key,
+ __attribute__((unused)) void *key_mask,
__attribute__((unused)) uint32_t key_size,
__attribute__((unused)) uint64_t seed)
{
} else
continue;
- *signature = test_hash(key, 0, 0);
+ *signature = test_hash(key, NULL, 0, 0);
}
do {
static void app_init_mbuf_pools(void);
uint64_t pipeline_test_hash(void *key,
+ __attribute__((unused)) void *key_mask,
__attribute__((unused)) uint32_t key_size,
__attribute__((unused)) uint64_t seed)
{
APP_METADATA_OFFSET(32)); \
k32 = (uint32_t *) key; \
k32[0] = (value); \
- *signature = pipeline_test_hash(key, 0, 0); \
+ *signature = pipeline_test_hash(key, NULL, 0, 0); \
rte_ring_enqueue((ring), m); \
} while (0)
/* Function definitions */
uint64_t pipeline_test_hash(
void *key,
+ __attribute__((unused)) void *key_mask,
__attribute__((unused)) uint32_t key_size,
__attribute__((unused)) uint64_t seed);
.key_mask = NULL,
.n_keys = 1 << 16,
.n_buckets = 1 << 16,
- .f_hash = (rte_table_hash_op_hash)pipeline_test_hash,
+ .f_hash = pipeline_test_hash,
.seed = 0,
};
.key_mask = NULL,
.n_keys = 1 << 16,
.n_buckets = 1 << 16,
- .f_hash = (rte_table_hash_op_hash)pipeline_test_hash,
+ .f_hash = pipeline_test_hash,
.seed = 0,
};
.key_mask = NULL,
.n_keys = 1 << 16,
.n_buckets = 1 << 16,
- .f_hash = (rte_table_hash_op_hash)pipeline_test_hash,
+ .f_hash = pipeline_test_hash,
.seed = 0,
};
.key_mask = NULL,
.n_keys = 1 << 16,
.n_buckets = 1 << 16,
- .f_hash = (rte_table_hash_op_hash)pipeline_test_hash,
+ .f_hash = pipeline_test_hash,
.seed = 0,
};
.key_mask = NULL,
.n_keys = 1 << 16,
.n_buckets = 1 << 16,
- .f_hash = (rte_table_hash_op_hash)pipeline_test_hash,
+ .f_hash = pipeline_test_hash,
.seed = 0,
};
.key_mask = NULL,
.n_keys = 1 << 16,
.n_buckets = 1 << 16,
- .f_hash = (rte_table_hash_op_hash)pipeline_test_hash,
+ .f_hash = pipeline_test_hash,
.seed = 0,
};
.key_mask = NULL,
.n_keys = 1 << 16,
.n_buckets = 1 << 16,
- .f_hash = (rte_table_hash_op_hash)pipeline_test_hash,
+ .f_hash = pipeline_test_hash,
.seed = 0,
};
memset(key, 0, 32); \
k32 = (uint32_t *) key; \
k32[0] = (value); \
- *signature = pipeline_test_hash(key, 0, 0); \
+ *signature = pipeline_test_hash(key, NULL, 0, 0); \
} while (0)
unsigned n_table_tests = RTE_DIM(table_tests);
.key_mask = NULL,
.n_keys = 1 << 10,
.n_buckets = 1 << 10,
- .f_hash = (rte_table_hash_op_hash)pipeline_test_hash,
+ .f_hash = pipeline_test_hash,
.seed = 0,
};
if (table != NULL)
return -4;
- hash_params.f_hash = (rte_table_hash_op_hash)pipeline_test_hash;
+ hash_params.f_hash = pipeline_test_hash;
table = ops->f_create(&hash_params, 0, 1);
if (table == NULL)
.key_mask = NULL,
.n_keys = 1 << 10,
.n_buckets = 1 << 10,
- .f_hash = (rte_table_hash_op_hash)pipeline_test_hash,
+ .f_hash = pipeline_test_hash,
.seed = 0,
};
if (table != NULL)
return -4;
- hash_params.f_hash = (rte_table_hash_op_hash)pipeline_test_hash;
+ hash_params.f_hash = pipeline_test_hash;
table = ops->f_create(&hash_params, 0, 1);
if (table == NULL)
if (table != NULL)
return -4;
- cuckoo_params.f_hash = (rte_table_hash_op_hash)pipeline_test_hash;
+ cuckoo_params.f_hash = pipeline_test_hash;
cuckoo_params.name = NULL;
table = rte_table_hash_cuckoo_ops.f_create(&cuckoo_params,