From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 28032A0613 for ; Wed, 28 Aug 2019 13:53:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E8FEB1C1EB; Wed, 28 Aug 2019 13:53:54 +0200 (CEST) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by dpdk.org (Postfix) with ESMTP id 5C94B1C1C9 for ; Wed, 28 Aug 2019 13:53:53 +0200 (CEST) Received: by mail-qt1-f195.google.com with SMTP id i4so2611379qtj.8 for ; Wed, 28 Aug 2019 04:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YfFm6trS8p3wpXqv6k7h1G2azPeOFy+gZjkfLIL84l8=; b=szZ8C/+9dehO6KmgSn1C7ukRZH07yFUeu5ca8gL8NRcxTWEkIJ2yZYPmSCJEvlPw1t Bhox+hQSQ/FnaSkqEIz8m2g8Bz27LwDw3lw6NKrhzF2AOk05QPLZHMjnAKstLClOuOFZ ZVz6OYJfx8RfDa08G6NlQRsBccTPHDXlmG5W1OMQMEwgrJrp6MMc+2fCKqCDfpJ1ASRw EhVIuVYuTlVlc0RLne/Os4mW1dx1qmmQnAUdEzVIbQ864csOwYe9Rf7OSFmchkPfGikk iMGlQHLAb2/7pkFOC/vjvi6p6Nk6PGm6s1Fzn93zFAMKDUlG+kS0uDvQckqmsg4O1KEN Yo3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YfFm6trS8p3wpXqv6k7h1G2azPeOFy+gZjkfLIL84l8=; b=N/gfxWsofdKQfk8kXdIiBjbapJ5T8sEVy4v1B1NlmLI4+S67dqJPnI65clVsIbY6ya MZZTHOeop0DqnpHZge5IgRVYwUFNR62vPgfbkyngqmpNUQ5/DMQVwQJhZrBhAjIB0dgI 2v4iohNf7T94nyqBV8ygoZp8zoBGjA2BCj4VVQCjd4ssIhcmjCEeYmzy2/tyNQlC26wP 2o6BgLcLzeObP0bWEytmpzCTve9l79os3TM/i//maLhEvtYc6A8M9+Zq/tASa12toyTZ SCc8jQgZbODX5vS0/1tc7RrRjSSVLY6AODpPFg+8VrrnTbeUwe3j5I9C1nLDqL1L1sYQ C7cw== X-Gm-Message-State: APjAAAXZl6eiXh1Wn3j7U7lFWe1EvcpQlHstt1Ld4cXaLkkmenFsBphc sT0mp9hnVYuXfEU1dSclbDjPhA== X-Google-Smtp-Source: APXvYqxX3YpElMsmGXcH78Q61qRgHCnj/G8j/7Jng1Pq5AQSyNnU8AhIvo+b9WucpgixvIFbVDjD+g== X-Received: by 2002:a0c:c93b:: with SMTP id r56mr2401501qvj.139.1566993232495; Wed, 28 Aug 2019 04:53:52 -0700 (PDT) Received: from xps13 (pool-96-233-168-28.spfdma.east.verizon.net. [96.233.168.28]) by smtp.gmail.com with ESMTPSA id d12sm1163387qkk.39.2019.08.28.04.53.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Aug 2019 04:53:52 -0700 (PDT) Date: Wed, 28 Aug 2019 07:53:47 -0400 From: Stephen Hemminger To: Bing Zhao Cc: yipeng1.wang@intel.com, sameh.gobriel@intel.com, bruce.richardson@intel.com, pablo.de.lara.guarch@intel.com, dev@dpdk.org Message-ID: <20190828075347.0efeee91@xps13> In-Reply-To: <1566975109-318949-2-git-send-email-bingz@mellanox.com> References: <1566975109-318949-1-git-send-email-bingz@mellanox.com> <1566975109-318949-2-git-send-email-bingz@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [RFC] rte_hash: introduce hash list into hash lib X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" On Wed, 28 Aug 2019 14:51:49 +0800 Bing Zhao wrote: > + > +/** Node element structure on the LIST of the link */ > +struct rte_hlist_node_entry { > + LIST_ENTRY(rte_hlist_node_entry) next; /**< Next element pointer. */ > + /**< Data element inside this noed. */ > + struct rte_hlist_data_element d; > + char key[]; /**< Copied and stored key. */ > +}; > + > +/** Head of all the nodes with the same hash value */ > +struct rte_hlist_head_entry { > + LIST_HEAD(, rte_hlist_node_entry) head; /**< Head for each hash list. */ > + /**< Current items in the list. */ > + uint16_t entries_in_bucket; > + /**< Shift number for extension */ > + uint16_t bucket_shift; > +}; > + > +/** The hlist table structure. */ > +struct rte_hlist_table { > + char name[RTE_HLIST_NAMESIZE]; /**< Name of the hash. */ > + uint32_t entries; /**< Total number of entries. */ > + uint32_t entries_per_bucket; /**< Number of entries in a list. */ > + /**< Number of entries with data from customer. */ > + uint32_t custom_entries; > + uint16_t key_len; /**< Length of the key. */ > + /**< Shift number of the whole table. */ > + uint16_t bucket_shift; > + /**< To find which list the key is in. */ > + uint32_t bucket_mask; > + rte_hlist_calc_fn hash_func; /**< The hash function to calcuate. */ > + /**< The function to free the custom data. */ > + rte_hlist_free_fn free_func; > + uint32_t init_val; /**< For initializing hash function. */ > + /**< Reserved for fast shrinking of the table. */ > + char *map; You probably should use void * for that. > + /**< A flat and extendible table of all lists. */ > + struct rte_hlist_head_entry *t; > +}; > + Since API/ABI considerations are important. You will save yourself a lot of pain if these structures can be made private and only part of rte_hlist.c.