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 2A139A0C56; Thu, 12 Aug 2021 18:24:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F2294014D; Thu, 12 Aug 2021 18:24:33 +0200 (CEST) Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) by mails.dpdk.org (Postfix) with ESMTP id 277C640042 for ; Thu, 12 Aug 2021 18:24:31 +0200 (CEST) Received: by mail-yb1-f179.google.com with SMTP id m193so12829877ybf.9 for ; Thu, 12 Aug 2021 09:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=oN9Bn/lBEebh8ydmrRavRrLbl502uqc8qYKyFMo4SJg=; b=dYLE2PvnwKTPWax0d/jo5psQG/HtMkbMULOGomumRc/EeT5lWb8kjmttd6GP2nBua5 8OhW1JguW/BhDf6fRY3/saGyZUsp5uyxPUIBqHjBIMgr6CnPdJ84I7su1RMBZe2ir7ia Jdlnb7TMwGMmLcrQtwKQR4AtlgjHofqQ0IFUWsBu0JiZTNJMukP+NwgngVPy2DmQOi6E 0DZni3VfoXHkkpxYV9scMxOC9Ter/gZBwORa4WPbMbTNmp/V9MFP+HFfN+jzBMJB0fWs 1C4ssPV2F1nJq76EumPeOV83KrzMhUcRByXQhKoFffW5gQvWUVcoLea+3h4aK7eT5ExU yuvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=oN9Bn/lBEebh8ydmrRavRrLbl502uqc8qYKyFMo4SJg=; b=jNbWfb37dNBddWYV7opn0E2VRjle6S8eCpN1577Aocsmq8KXMa/NIehtN1HuHtWk2h T0XiPJLe1S0Arfl4EE55onMaJvB3OoAir5SFuUyFW1bwWqtECIG8w+j1zCxJUFq3PBg3 qwRBIbTxCSy0QFYcK1VRZreewivfEJLaYJeWxZXZ9yPyqIf+iFLVBCoY/bI0mOa9CCl8 htglfORB4tUsnfiEVYyd99rM8zErJTQBLcOOjnxRXtHIpPmsanp2dOKFaWRDQPYy57WQ fdRsTqTsKA5PY2TcfLLRVV4kpD1uYasJB0EimPg5vep7iwjbelR3NAaBGYtmyM4o15y3 Lk0Q== X-Gm-Message-State: AOAM532Our6IznGLbWGQAGZ8ycreUko682OWu9OgTIXkzdYMJytRdQ96 CfRjgbjN9wec1W0lGmGWJDd3TrImQSFJLq7w9O02zLvLKi0FvA== X-Google-Smtp-Source: ABdhPJwLLR+7ohYLNVJ4zY3NeOqS/beMn9CC2C9v8QG3bFcep4WqgqwR7hqi7KuwA989A1gEsJz1kWWFyIdTF2hnO0w= X-Received: by 2002:a25:b787:: with SMTP id n7mr5706142ybh.468.1628785470211; Thu, 12 Aug 2021 09:24:30 -0700 (PDT) MIME-Version: 1.0 From: Ravi Kerur Date: Thu, 12 Aug 2021 09:24:19 -0700 Message-ID: To: dpdk-dev Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] Q on rte hash table X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hello, Using dpdk 19.11 and trying to understand the index returned by 'rte_hash_add_key', API says ... * - A positive value that can be used by the caller as an offset into an * array of user data. This value is unique for this key. */ int32_t rte_hash_add_key(const struct rte_hash *h, const void *key); I create hash with 64 entries and other params as follows struct rte_hash_parameters user_params = { .name = "test_hash", .entries = 64, .key_len = sizeof(uint32_t), .hash_func = rte_hash_crc, .hash_func_init_val = 0, }; Extra flags has extra_flag = RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; user_hash_tbl = rte_hash_create(&user_params); When I add a key to the table I was expecting returned index to be in the range '0 - 63' user_idx = rte_hash_add_key(user_hash_tbl, (void *)&user_id); However, I am seeing user_idx values 127, 128, ... Due to MULTI_WRITE_ADD num_of_slots is calculated is as follows when creating a table. num_key_slots = params->entries + (RTE_MAX_LCORE - 1) * (LCORE_CACHE_SIZE - 1) + 1; with RTE_MAX_LCORE = 255, LCORE_CACHE_SIZE = 64 num_key_slots come to 16067 In my case the user_idx range can be '0 - 16067' . Is this correct? Thanks, Ravi