DPDK patches and discussions
 help / color / mirror / Atom feed
From: venkatesh bs <venki.bsv@gmail.com>
To: dev@dpdk.org
Subject: Question regarding rte_hash_hash and rte_hash_add_key_with_hash_data
Date: Sun, 8 Jun 2025 00:36:02 +0530	[thread overview]
Message-ID: <CAM3UhOgt2UmtWhvobLyVzX=gmj46+RrSNGbfKH3fSQ-yhxTw3g@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]

Hi @dpdk community,

In my application, I am using the dpdk hash table as below.

1. calculate the hash value.
2. using this signature add the key and data into  a table.
3. lock is used in the 2nd call (add).

Below is the code sniffer for the same.
==================================================================
     hash_sig_t sig = rte_hash_hash(hash_tablele, (void *) &new_key);

     pthread_mutex_lock(&lock);
      int32_t ret = rte_hash_add_key_with_hash_data(hash_table,
                          (void *)&new_key,
                           sig,
                           info);

if (ret < 0)
{
         pthread_mutex_unlock(lock);
         return TOS_E_FAIL;
}
pthread_mutex_unlock(lock);

return OK..
==================================================================

My application is having a lot of threads and when run with heavy load , I
am getting a lot of insertion failure, i felt the reason could be
calculating and adding the has value in 2 api's as opposed to
rte_hash_add() that is safe under a lock..


Please let me know your thoughts.


Thank you,
Venkatesh.

[-- Attachment #2: Type: text/html, Size: 1574 bytes --]

             reply	other threads:[~2025-06-08  9:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-07 19:06 venkatesh bs [this message]
2025-06-08 15:47 ` Stephen Hemminger

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='CAM3UhOgt2UmtWhvobLyVzX=gmj46+RrSNGbfKH3fSQ-yhxTw3g@mail.gmail.com' \
    --to=venki.bsv@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).