From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7C561A0C3F for ; Fri, 9 Apr 2021 03:34:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7C4B44068E; Fri, 9 Apr 2021 03:34:50 +0200 (CEST) Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by mails.dpdk.org (Postfix) with ESMTP id CA2974014D for ; Fri, 9 Apr 2021 03:34:48 +0200 (CEST) Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 593E22400E5 for ; Fri, 9 Apr 2021 03:34:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1617932088; bh=gh2WWy3BcPrITb0xB/7SAgsvF7+bN082nyIru8/RxOg=; h=From:To:Subject:Date:From; b=N0hdejRDLz0TiFZzGYxqtAB0HBqLH+e0IKgD7tU/Kuhq+TmURGdcZKjXTlqSHN6ML qL1pDxX6oojGq2c55cGlQ4UE7goIzSmdjFSl/KWsnT1IrtR/MsClvkNQBzGPvlnATg TGI37uvgQZPWAPZvqaRvnso5KRihE5KhlDh+oAlwnwd9gnNQRSmRx/SJqQpy8FrVW6 I3wYnZtsfz8rstYNICkd9pxImCXRyH0EJWvLMe8dsU6r83+LrMkd1obUKGlZbqhKKh RwcdNeVLi24Rte421bkcXre7BHyc8FBZ7h99RE33do0xuADK1PwaSylSQTmIpGrF5R R2WFC4aeX8wXA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FGgfb2ZjSz6tm4 for ; Fri, 9 Apr 2021 03:34:47 +0200 (CEST) From: Cacheco Gnudu To: users@dpdk.org Message-ID: <0c7bef87-3e9e-fd5d-f207-a11943213781@posteo.net> Date: Thu, 8 Apr 2021 22:35:30 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: [dpdk-users] Failing to add entry to hashmap X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org Sender: "users" Hello everyone, I'm programming a testbed with DPDK that needs to create a hashmap with 32768 entries and maybe more in the future. To create it, I use rte_hash_add_key_data() inside a for loop. I was checking the return value of rte_hash_add_key_data() and whenever it was negative, the program would terminate with rte_exit(). Every time it added the 32224th entry it would terminate with -ENOSPC. I replaced rte_exit() to a simple printf() to let me know it received a negative value from rte_hash_add_key_data(), but would keep adding new entries and it does. It alternatively succeeds and fails, and when it fails its always with -ENOSPC. At the end only 32640 entries are added. I pasted the hash creation code and the end of the execution output as well. --- code starts here --- /* ... */ #define MAX_IPS 32768 /* ... */ int err = 0; static struct rte_hash *PPVE_HASHMAP; struct rte_hash_parameters params = { 0 }; params.name = "ip_filter_hashmap"; params.entries = MAX_IPS; params.key_len = sizeof(uint64_t); params.hash_func = rte_jhash; params.hash_func_init_val = 0; params.socket_id = rte_socket_id(); uint32_t size = rte_hash_count(PPVE_HASHMAP); printf("%d\n", size); PPVE_HASHMAP = rte_hash_create(¶ms); if (PPVE_HASHMAP == NULL) rte_exit(EXIT_DPDK_FAIL, "Failed to create hash table, errno = %d\n", rte_errno); size = rte_hash_count(PPVE_HASHMAP); printf("%d\n", size); uint64_t key = 10, value = 0xdead; for (int i = 0; i < MAX_IPS; i++) { err = rte_hash_add_key_data(PPVE_HASHMAP, &key, &value); uint32_t size = rte_hash_count(PPVE_HASHMAP); printf("%d\n", size); if (err < 0) rte_exit(EXIT_DPDK_FAIL, "Failed to add entry to hash table, err: %d\n", err); key++; } /* ... */ --- code ends here --- --- end of program output starts here --- 32635 32635 Failed to add entry to hash table, err: -28 32636 32637 32638 32639 32639 Failed to add entry to hash table, err: -28 32640 32640 Failed to add entry to hash table, err: -28 32640 Failed to add entry to hash table, err: -28 32640 Failed to add entry to hash table, err: -28 32640 Failed to add entry to hash table, err: -28 32640 Failed to add entry to hash table, err: -28 32640 Failed to add entry to hash table, err: -28 32640 Failed to add entry to hash table, err: -28 32640 Failed to add entry to hash table, err: -28 32640 Failed to add entry to hash table, err: -28 --- end of program output ends here --- -- Sincerely, Cacheco