DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] My questions about dpdk hash
@ 2017-04-06 10:57  =?gb18030?B?s8no69XfsfA=?=
  2017-04-06 11:27 ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 2+ messages in thread
From: =?gb18030?B?s8no69XfsfA=?= @ 2017-04-06 10:57 UTC (permalink / raw)
  To: =?gb18030?B?dXNlcnM=?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 1346 bytes --]

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.


     Any help would be appreciated.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-users] My questions about dpdk hash
  2017-04-06 10:57 [dpdk-users] My questions about dpdk hash  =?gb18030?B?s8no69XfsfA=?=
@ 2017-04-06 11:27 ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 2+ messages in thread
From: De Lara Guarch, Pablo @ 2017-04-06 11:27 UTC (permalink / raw)
  To: 373755701, users

Hi,

> -----Original Message-----
> From: users [mailto:users-bounces@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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-06 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-06 10:57 [dpdk-users] My questions about dpdk hash  =?gb18030?B?s8no69XfsfA=?=
2017-04-06 11:27 ` De Lara Guarch, Pablo

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).