diff options
author | Dave Barach <dave@barachs.net> | 2018-02-23 07:45:36 -0500 |
---|---|---|
committer | Dave Barach <dave@barachs.net> | 2018-02-23 08:02:18 -0500 |
commit | 30765e77ac98913abefbdb9e8325a2b3f1e11082 (patch) | |
tree | e6d4c0d579913ad6dee9148dc5da72d660612312 /src/vppinfra/bihash_doc.h | |
parent | 4ef4226282685a049aad439080ca5478da09ac06 (diff) |
Add prefetch inlines, update bi-hash doc tags
Change-Id: I2e9d01ccba5288e89b886464436097d3cb7d2d18
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vppinfra/bihash_doc.h')
-rw-r--r-- | src/vppinfra/bihash_doc.h | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/src/vppinfra/bihash_doc.h b/src/vppinfra/bihash_doc.h index e6ab9db6d30..a7e70e9695c 100644 --- a/src/vppinfra/bihash_doc.h +++ b/src/vppinfra/bihash_doc.h @@ -78,7 +78,9 @@ typedef struct u8 *name; /**< hash table name */ BVT (clib_bihash_value) ** freelists; /**< power of two freelist vector */ - void *mheap; /**< clib memory heap */ + uword alloc_arena; /**< memory allocation arena */ + uword alloc_arena_next; /**< first available mem chunk */ + uword alloc_arena_size; /**< size of the arena */ } clib_bihash_t; /** Get pointer to value page given its clib mheap offset */ @@ -117,16 +119,51 @@ void clib_bihash_free (clib_bihash * h); int clib_bihash_add_del (clib_bihash * h, clib_bihash_kv * add_v, int is_add); +/** Search a bi-hash table, use supplied hash code + + @param h - the bi-hash table to search + @param hash - the hash code + @param in_out_kv - (key,value) pair containing the search key + @returns 0 on success (with in_out_kv set), < 0 on error +*/ +int clib_bihash_search_inline_with_hash + (clib_bihash * h, u64 hash, clib_bihash_kv * in_out_kv); + /** Search a bi-hash table @param h - the bi-hash table to search - @param search_v - (key,value) pair containing the search key - @param return_v - (key,value) pair which matches search_v.key - @returns 0 on success (with return_v set), < 0 on error + @param in_out_kv - (key,value) pair containing the search key + @returns 0 on success (with in_out_kv set), < 0 on error +*/ +int clib_bihash_search_inline (clib_bihash * h, clib_bihash_kv * in_out_kv); + +/** Prefetch a bi-hash bucket given a hash code + + @param h - the bi-hash table to search + @param hash - the hash code + @note see also clib_bihash_hash to compute the code */ -int clib_bihash_search (clib_bihash * h, - clib_bihash_kv * search_v, clib_bihash_kv * return_v); +void clib_bihash_prefetch_bucket (clib_bihash * h, u64 hash); +/** Prefetch bi-hash (key,value) data given a hash code + + @param h - the bi-hash table to search + @param hash - the hash code + @note assumes that the bucket has been prefetched, see + clib_bihash_prefetch_bucket +*/ +void clib_bihash_prefetch_data (clib_bihash * h, u64 hash); + +/** Search a bi-hash table + + @param h - the bi-hash table to search + @param search_key - (key,value) pair containing the search key + @param valuep - (key,value) set to search result + @returns 0 on success (with valuep set), < 0 on error + @note used in situations where key modification is not desired +*/ +int clib_bihash_search_inline_2 + (clib_bihash * h, clib_bihash_kv * search_key, clib_bihash_kv * valuep); /** Visit active (key,value) pairs in a bi-hash table |