[dpdk-users] My questions about dpdk hash

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Thu Apr 6 13:27:05 CEST 2017


Hi,

> -----Original Message-----
> From: users [mailto:users-bounces at dpdk.org] On Behalf Of ????
> Sent: Thursday, April 06, 2017 11:58 AM
> To: users
> Subject: [dpdk-users] My questions about dpdk hash
> 
> Hi all:
>      here is my pseudo code:
>      struct HASH_KEY
>      {
>          int data1;
>          int data2;
>       };
>      void test_hash_add_key()
>      {
>         struct rte_hash* testHash;
>         struct rte_hash_parameters hash_params;
>         hash_params.name = "xxxyyy";
>         hash_params.entries = 64;
>         hash_params.hash_func = rte_jhash;
>         hash_params.hash_func_init_val = 0;
>         hash_params.key_len = sizeof(struct HASH_KEY);
>         hash_params.socket_id = rte_socket_id();
> 
>         testHash = rte_hash_create(&hash_params);
>         if(NULL == testHash)
>         {
>            return;
>          }
>           struct HASH_KEY hashKey;
>           hashKey.data1=1;
>           hashKey.data2=2;
>           int iRet = rte_hash_add_key(testHash,(void*)&hashKey);
>       }
> 
> 
>        int main()
>        {
>           rte_eal_init();
>           test_hash_add_key();
>           return 0;
>         }
> 
> 
> The program give me a error "signal SIGILL ,illegal instruction"  in
> __rte_hash_add_key_with_hash,when i GDB it.
> 
> 
> Using "static struct rte_hash_parameters hash_params; " or "static struct
> HASH_KEY hashKey; program would be OKey." , program would be okey
> and the error disappeared.
> BUT,the test demo is so simple, I want to know WHY can it encounter an
> error.

I have tried your code, and I don't see have any issues as it is.
Don't know why using static solves the problem, as you are only calling the function once,
so those structures were going to be used and initialized once anyway.

Where do you see the illegal instruction in gdb?

Pablo
> 
> 
>      Any help would be appreciated.


More information about the users mailing list