DPDK usage discussions
 help / color / mirror / Atom feed
From: Mohsen Meamarian <meamarian.mohsen@gmail.com>
To: users@dpdk.org
Subject: hash lookup in secondary process
Date: Tue, 28 May 2024 23:39:16 +0200	[thread overview]
Message-ID: <CAM-Ptb75nQNqXkCLvDR2_j94K3QDZ+N9w3nmBupGKOoX0PxdkA@mail.gmail.com> (raw)

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

Hi all,

I have two dpdk app, one primary and one secondary. I create a hash table
in the primary dpdk app like this:

static struct rte_hash_parameters ut_params = {
    .name = "BufferTable2",
    .entries = 1024*256,
    .key_len = sizeof(uint64_t),
    .hash_func = rte_jhash,
    //.extra_flag=RTE_HASH_EXTRA_FLAGS_EXT_TABLE,
    //.extra_flag=RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY,
};

    buffer_table = rte_hash_create(&ut_params);
    if (buffer_table == NULL) {
        printf("UNABLE TO CREATE HASHTABLE\n");
        rte_exit(EXIT_FAILURE, "UNABLE TO CREATE HASHTABLE\n");
    }


and in secondary I use :

    h=rte_hash_find_existing("BufferTable1");
    if (!h) {
        fprintf(stderr, "Failed to find existing hash table\n");
        return -1;
    }

int ret = rte_hash_lookup_data(buffer_table, &teid,
(void**)&packet_in_bucket);

I can find the table pointer, but it gives a segmentation fault when I want
to look up something or add some key value.
I cannot add a key value in the primary app, so it should be in the
secondary app.

I checked rte_hash_lookup_with_hash_data and rte_hash_add_key_with_hash.
these get a hash signature along with a key/value. but it also gives
segfault. in this way, the hash sig should be calculated manually.


I saw this too in dpdk doc:

The use of function pointers between multiple processes running based on
different compiled binaries is not supported, since the location of a given
function in one process may be different from its location in a second.
This prevents the librte_hash library from behaving properly as in a
multi-process instance since it uses a pointer to the hash function
internally.
https://doc.dpdk.org/guides/prog_guide/multi_proc_support.html

can you explain what I should do?
dpdk version 24.03



Best,
Mohsen

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

                 reply	other threads:[~2024-05-28 21:39 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=CAM-Ptb75nQNqXkCLvDR2_j94K3QDZ+N9w3nmBupGKOoX0PxdkA@mail.gmail.com \
    --to=meamarian.mohsen@gmail.com \
    --cc=users@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).