* [dpdk-dev] Q on rte hash table
@ 2021-08-12 16:24 Ravi Kerur
0 siblings, 0 replies; only message in thread
From: Ravi Kerur @ 2021-08-12 16:24 UTC (permalink / raw)
To: dpdk-dev
Hello,
Using dpdk 19.11 and trying to understand the index returned by
'rte_hash_add_key', API says
...
* - A positive value that can be used by the caller as an offset into an
* array of user data. This value is unique for this key.
*/
int32_t
rte_hash_add_key(const struct rte_hash *h, const void *key);
I create hash with 64 entries and other params as follows
struct rte_hash_parameters user_params = {
.name = "test_hash",
.entries = 64,
.key_len = sizeof(uint32_t),
.hash_func = rte_hash_crc,
.hash_func_init_val = 0,
};
Extra flags has
extra_flag =
RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY |
RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD;
user_hash_tbl = rte_hash_create(&user_params);
When I add a key to the table I was expecting returned index to be in the
range '0 - 63'
user_idx = rte_hash_add_key(user_hash_tbl, (void *)&user_id);
However, I am seeing user_idx values 127, 128, ...
Due to MULTI_WRITE_ADD num_of_slots is calculated is as follows when
creating a table.
num_key_slots = params->entries + (RTE_MAX_LCORE - 1) *
(LCORE_CACHE_SIZE - 1) + 1;
with RTE_MAX_LCORE = 255, LCORE_CACHE_SIZE = 64
num_key_slots come to 16067
In my case the user_idx range can be '0 - 16067' . Is this correct?
Thanks,
Ravi
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-12 16:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 16:24 [dpdk-dev] Q on rte hash table Ravi Kerur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).