[dpdk-users] RTE Hash addition results to segmentation fault
Jatin Sahu
jatin152 at gmail.com
Thu Oct 22 14:03:27 CEST 2020
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 at 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
More information about the users
mailing list