DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ravi Kerur <rkerur@gmail.com>
To: dpdk-dev <dev@dpdk.org>
Subject: [dpdk-dev] Q on rte hash table
Date: Thu, 12 Aug 2021 09:24:19 -0700	[thread overview]
Message-ID: <CAFb4SLCOQx6gTc+PMC5RKPL6d1Q6zOToaGu6jT0C2JMivqQWgQ@mail.gmail.com> (raw)

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

                 reply	other threads:[~2021-08-12 16:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFb4SLCOQx6gTc+PMC5RKPL6d1Q6zOToaGu6jT0C2JMivqQWgQ@mail.gmail.com \
    --to=rkerur@gmail.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).