DPDK usage discussions
 help / color / mirror / Atom feed
From: Jatin Sahu <jatin152@gmail.com>
To: users@dpdk.org
Subject: Re: [dpdk-users] RTE Hash addition results to segmentation fault
Date: Fri, 23 Oct 2020 16:40:24 +0530	[thread overview]
Message-ID: <CAL2oWpUzib_YmjoPF5PMg87-BzYYJhAtPEj+o+_jC0c+DXQ=1w@mail.gmail.com> (raw)
In-Reply-To: <CAL2oWpXruQV2NHFTefOmbBaXenKpY2+An5pQdcFqAW=CYdxYuQ@mail.gmail.com>

Hello guyz,
Any reference to resolve this issue?

On Thu, 22 Oct, 2020, 5:33 pm Jatin Sahu, <jatin152@gmail.com> wrote:

> Hi,
>
> I am using DPDK's RTE hash data structure in a test application.
> The RTE initlilization and hash creation are successful but adding key to
> hash results in segmentation fault.
>
> Please find the details of code snipped, output and stack trace.
> I have written this code using example "server_node_efd/node/node.c" as
> reference.
> Please advise if there is any issue in usage or configuration.
>
> *Version: *dpdk-stable-18.11.6
>
> *Output:*
> [roamware@loadtestsrv dpdk-hash]$ ./Test
> EAL: Detected 72 lcore(s)
> EAL: Detected 2 NUMA nodes
> EAL: Multi-process socket /run/user/1000/dpdk/rte/mp_socket
> EAL: Probing VFIO support...
> EAL: Started without hugepages support, physical addresses not available
> Hash table created. Count:0
> Inserting key:d2040000 KeyAddr:0x7ffc2b1761fc
> Segmentation fault (core dumped)
>
> *Stack trace:*
> (gdb) where
> #0  0x000000000000007f in ?? ()
> #1  0x00000000004f0c48 in rte_hash_add_key ()
> #2  0x000000000047b08c in test () at HashTest.cpp:47
>
> *Code snippet:*
>
>> *void test()*
>> *{*
>> *        /* rte init */*
>> *        int   argc = 4;*
>> *        char *argv[] = {*
>> *                "HashTest",*
>> *                "-c",*
>> *                "0x2",*
>> *                "--no-huge"*
>> *        };*
>> *        int rc = rte_eal_init(argc, argv);*
>> *        if(rc < 0)*
>> *                rte_exit(EXIT_FAILURE, "RTE init failed \n");*
>>
>>
>> *        /* create hash table */*
>> *        uint32_t num_flows_node = 10;*
>> *        char name[100];*
>> *        struct rte_hash *h;*
>> *        struct rte_hash_parameters hash_params;*
>> *        int node_id=0;*
>> *        hash_params.entries = num_flows_node * 2; /* table load = 50% */*
>> *        hash_params.key_len = sizeof(uint32_t); /* Store IPv4 dest IP
>> address */*
>> *        hash_params.socket_id = rte_socket_id();*
>> *        hash_params.hash_func_init_val = 0;*
>> *        snprintf(name, sizeof(name), "hash_table");*
>> *        hash_params.name <http://hash_params.name> = name;*
>> *        h = rte_hash_create(&hash_params);*
>> *        if (h == NULL)*
>> *                rte_exit(EXIT_FAILURE, "Problem creating the hash table
>> for node %d\n", node_id);*
>> *        else*
>> *                fprintf(stderr, "Hash table created. Count:%d\n",
>> rte_hash_count(h));*
>>
>>
>> *        /* insert record to hash table */*
>> *        unsigned int i=1234;*
>> *        int32_t ret;*
>> *        uint32_t ip_dst;*
>> *        ip_dst = rte_cpu_to_be_32(i);*
>> *        fprintf(stderr, "Inserting key:%x KeyAddr:%p\n", ip_dst,
>> &ip_dst);*
>> *        ret = rte_hash_add_key(h, (void *) &ip_dst);*
>> *        if (ret < 0)*
>> *                rte_exit(EXIT_FAILURE, "Unable to add entry %u in hash
>> table\n", i);*
>> *}*
>
>
> Regards,
> Jatin
>

      reply	other threads:[~2020-10-23 11:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 12:03 Jatin Sahu
2020-10-23 11:10 ` Jatin Sahu [this message]

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='CAL2oWpUzib_YmjoPF5PMg87-BzYYJhAtPEj+o+_jC0c+DXQ=1w@mail.gmail.com' \
    --to=jatin152@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).