DPDK usage discussions
 help / color / mirror / Atom feed
From: Jatin Sahu <jatin152@gmail.com>
To: users@dpdk.org
Cc: chandrika.gautam@mobileum.com, jatin.sahu@mobileum.com,
	 sumit.bhatkar@mobileum.com
Subject: [dpdk-users] RTE Hash addition results to segmentation fault
Date: Thu, 22 Oct 2020 17:33:27 +0530	[thread overview]
Message-ID: <CAL2oWpXruQV2NHFTefOmbBaXenKpY2+An5pQdcFqAW=CYdxYuQ@mail.gmail.com> (raw)

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-22 12:03 UTC|newest]

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

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='CAL2oWpXruQV2NHFTefOmbBaXenKpY2+An5pQdcFqAW=CYdxYuQ@mail.gmail.com' \
    --to=jatin152@gmail.com \
    --cc=chandrika.gautam@mobileum.com \
    --cc=jatin.sahu@mobileum.com \
    --cc=sumit.bhatkar@mobileum.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).