DPDK usage discussions
 help / color / mirror / Atom feed
From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: "373755701@qq.com" <373755701@qq.com>, users <users@dpdk.org>
Subject: Re: [dpdk-users] My questions about dpdk hash
Date: Thu, 6 Apr 2017 11:27:05 +0000	[thread overview]
Message-ID: <E115CCD9D858EF4F90C690B0DCB4D89747804C12@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <tencent_76C1F5CD70706C61225E0A78@qq.com>

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.

      reply	other threads:[~2017-04-06 11:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 10:57  =?gb18030?B?s8no69XfsfA=?=
2017-04-06 11:27 ` De Lara Guarch, Pablo [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=E115CCD9D858EF4F90C690B0DCB4D89747804C12@IRSMSX108.ger.corp.intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=373755701@qq.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).