xref: /dpdk/doc/guides/prog_guide/hash_lib.rst (revision 41dd9a6bc2d9c6e20e139ad713cc9d172572dd43)
15630257fSFerruh Yigit..  SPDX-License-Identifier: BSD-3-Clause
25630257fSFerruh Yigit    Copyright(c) 2010-2015 Intel Corporation.
3e605a1d3SHonnappa Nagarahalli    Copyright(c) 2018 Arm Limited.
4fc1f2750SBernard Iremonger
5fc1f2750SBernard IremongerHash Library
6fc1f2750SBernard Iremonger============
7fc1f2750SBernard Iremonger
848624fd9SSiobhan ButlerThe DPDK provides a Hash Library for creating hash table for fast lookup.
9fc1f2750SBernard IremongerThe hash table is a data structure optimized for searching through a set of entries that are each identified by a unique key.
1048624fd9SSiobhan ButlerFor increased performance the DPDK Hash requires that all the keys have the same number of bytes which is set at the hash creation time.
11fc1f2750SBernard Iremonger
12fc1f2750SBernard IremongerHash API Overview
13fc1f2750SBernard Iremonger-----------------
14fc1f2750SBernard Iremonger
158747682aSYipeng WangThe main configuration parameters for the hash table are:
16fc1f2750SBernard Iremonger
178747682aSYipeng Wang*   Total number of hash entries in the table
18fc1f2750SBernard Iremonger
19fc1f2750SBernard Iremonger*   Size of the key in bytes
20fc1f2750SBernard Iremonger
218747682aSYipeng Wang*   An extra flag to describe additional settings, for example the multithreading mode of operation and extendable bucket functionality (as will be described later)
22f4ec5e5bSYipeng Wang
238747682aSYipeng WangThe hash table also allows the configuration of some low-level implementation related parameters such as:
24fc1f2750SBernard Iremonger
258747682aSYipeng Wang*   Hash function to translate the key into a hash value
26fc1f2750SBernard Iremonger
278747682aSYipeng WangThe main methods exported by the Hash Library are:
28fc1f2750SBernard Iremonger
298747682aSYipeng Wang*   Add entry with key: The key is provided as input. If the new entry is successfully added to the hash table for the specified key,
308747682aSYipeng Wang    or there is already an entry in the hash table for the specified key, then the position of the entry is returned.
318747682aSYipeng Wang    If the operation was not successful, for example due to lack of free entries in the hash table, then a negative value is returned.
32fc1f2750SBernard Iremonger
33fc1f2750SBernard Iremonger*   Delete entry with key: The key is provided as input. If an entry with the specified key is found in the hash,
348747682aSYipeng Wang    then the entry is removed from the hash table and the position where the entry was found in the hash table is returned.
358747682aSYipeng Wang    If no entry with the specified key exists in the hash table, then a negative value is returned
36fc1f2750SBernard Iremonger
378747682aSYipeng Wang*   Lookup for entry with key: The key is provided as input. If an entry with the specified key is found in the hash table (i.e., lookup hit),
388747682aSYipeng Wang    then the position of the entry is returned, otherwise (i.e., lookup miss) a negative value is returned.
39fc1f2750SBernard Iremonger
408747682aSYipeng WangApart from the basic methods explained above, the Hash Library API provides a few more advanced methods to query and update the hash table:
4127bd48ffSPablo de Lara
428747682aSYipeng Wang*   Add / lookup / delete entry with key and precomputed hash: Both the key and its precomputed hash are provided as input. This allows
438747682aSYipeng Wang    the user to perform these operations faster, as the hash value is already computed.
4427bd48ffSPablo de Lara
458747682aSYipeng Wang*   Add / lookup entry with key and data: A data is provided as input for add. Add allows the user to store
468747682aSYipeng Wang    not only the key, but also the data which may be either a 8-byte integer or a pointer to external data (if data size is more than 8 bytes).
4727bd48ffSPablo de Lara
488747682aSYipeng Wang*   Combination of the two options above: User can provide key, precomputed hash, and data.
4927bd48ffSPablo de Lara
508747682aSYipeng Wang*   Ability to not free the position of the entry in the hash table upon calling delete. This is useful for multi-threaded scenarios where
51e605a1d3SHonnappa Nagarahalli    readers continue to use the position even after the entry is deleted.
52e605a1d3SHonnappa Nagarahalli
538747682aSYipeng WangAlso, the API contains a method to allow the user to look up entries in batches, achieving higher performance
5427bd48ffSPablo de Larathan looking up individual entries, as the function prefetches next entries at the time it is operating
558747682aSYipeng Wangwith the current ones, which reduces significantly the performance overhead of the necessary memory accesses.
56f4ec5e5bSYipeng Wang
5727bd48ffSPablo de Lara
5827bd48ffSPablo de LaraThe actual data associated with each key can be either managed by the user using a separate table that
59fc1f2750SBernard Iremongermirrors the hash in terms of number of entries and position of each entry,
608747682aSYipeng Wangas shown in the Flow Classification use case described in the following sections,
6127bd48ffSPablo de Laraor stored in the hash table itself.
62fc1f2750SBernard Iremonger
638747682aSYipeng WangThe example hash tables in the L2/L3 Forwarding sample applications define which port to forward a packet to based on a packet flow identified by the five-tuple lookup.
64fc1f2750SBernard IremongerHowever, this table could also be used for more sophisticated features and provide many other functions and actions that could be performed on the packets and flows.
65fc1f2750SBernard Iremonger
66f9bd3342SPablo de LaraMulti-process support
67f9bd3342SPablo de Lara---------------------
68f9bd3342SPablo de Lara
69f4ec5e5bSYipeng WangThe hash library can be used in a multi-process environment.
70f9bd3342SPablo de LaraThe only function that can only be used in single-process mode is rte_hash_set_cmp_func(), which sets up
71f9bd3342SPablo de Laraa custom compare function, which is assigned to a function pointer (therefore, it is not supported in
72f9bd3342SPablo de Laramulti-process mode).
73f9bd3342SPablo de Lara
74f4ec5e5bSYipeng Wang
75f4ec5e5bSYipeng WangMulti-thread support
76f4ec5e5bSYipeng Wang---------------------
77f4ec5e5bSYipeng Wang
78f4ec5e5bSYipeng WangThe hash library supports multithreading, and the user specifies the needed mode of operation at the creation time of the hash table
79f4ec5e5bSYipeng Wangby appropriately setting the flag. In all modes of operation lookups are thread-safe meaning lookups can be called from multiple
80f4ec5e5bSYipeng Wangthreads concurrently.
81f4ec5e5bSYipeng Wang
82f4ec5e5bSYipeng WangFor concurrent writes, and concurrent reads and writes the following flag values define the corresponding modes of operation:
83f4ec5e5bSYipeng Wang
84f4ec5e5bSYipeng Wang*  If the multi-writer flag (RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD) is set, multiple threads writing to the table is allowed.
85f4ec5e5bSYipeng Wang   Key add, delete, and table reset are protected from other writer threads. With only this flag set, readers are not protected from ongoing writes.
86f4ec5e5bSYipeng Wang
87f4ec5e5bSYipeng Wang*  If the read/write concurrency (RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY) is set, multithread read/write operation is safe
88e605a1d3SHonnappa Nagarahalli   (i.e., application does not need to stop the readers from accessing the hash table until writers finish their updates. Readers and writers can operate on the table concurrently).
89e605a1d3SHonnappa Nagarahalli   The library uses a reader-writer lock to provide the concurrency.
90f4ec5e5bSYipeng Wang
91f4ec5e5bSYipeng Wang*  In addition to these two flag values, if the transactional memory flag (RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT) is also set,
928747682aSYipeng Wang   the reader-writer lock will use hardware transactional memory (e.g., Intel® TSX) if supported to guarantee thread safety.
93f4ec5e5bSYipeng Wang   If the platform supports Intel® TSX, it is advised to set the transactional memory flag, as this will speed up concurrent table operations.
94f4ec5e5bSYipeng Wang   Otherwise concurrent operations will be slower because of the overhead associated with the software locking mechanisms.
95f4ec5e5bSYipeng Wang
96e605a1d3SHonnappa Nagarahalli*  If lock free read/write concurrency (RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF) is set, read/write concurrency is provided without using reader-writer lock.
978747682aSYipeng Wang   For platforms (e.g., current ARM based platforms) that do not support transactional memory, it is advised to set this flag to achieve greater scalability in performance.
988747682aSYipeng Wang   If this flag is set, the (RTE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL) flag is set by default.
99e605a1d3SHonnappa Nagarahalli
1008747682aSYipeng Wang*  If the 'do not free on delete' (RTE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL) flag is set, the position of the entry in the hash table is not freed upon calling delete(). This flag is enabled
1018747682aSYipeng Wang   by default when the lock free read/write concurrency flag is set. The application should free the position after all the readers have stopped referencing the position.
102e605a1d3SHonnappa Nagarahalli   Where required, the application can make use of RCU mechanisms to determine when the readers have stopped referencing the position.
103769b2de7SDharmik Thakkar   RCU QSBR process is integrated within the Hash library for safe freeing of the position. Application has certain responsibilities while using this feature.
104769b2de7SDharmik Thakkar   For example, rte_hash_rcu_qsbr_add() need to be called to use the integrated RCU mechanism.
105*41dd9a6bSDavid Young   Please refer to resource reclamation framework of :doc:`rcu_lib` for more details.
106769b2de7SDharmik Thakkar
107e605a1d3SHonnappa Nagarahalli
1088747682aSYipeng WangExtendable Bucket Functionality support
1098747682aSYipeng Wang----------------------------------------
1108747682aSYipeng WangAn extra flag is used to enable this functionality (flag is not set by default). When the (RTE_HASH_EXTRA_FLAGS_EXT_TABLE) is set and
1118747682aSYipeng Wangin the very unlikely case due to excessive hash collisions that a key has failed to be inserted, the hash table bucket is extended with a linked
1128747682aSYipeng Wanglist to insert these failed keys. This feature is important for the workloads (e.g. telco workloads) that need to insert up to 100% of the
113f401363dSDharmik Thakkarhash table size and can't tolerate any key insertion failure (even if very few).
114769b2de7SDharmik ThakkarPlease note that with the 'lock free read/write concurrency' flag enabled, users need to call 'rte_hash_free_key_with_position' API or configure integrated RCU QSBR
115769b2de7SDharmik Thakkar(or use external RCU mechanisms) in order to free the empty buckets and deleted keys, to maintain the 100% capacity guarantee.
1168747682aSYipeng Wang
1178747682aSYipeng WangImplementation Details (non Extendable Bucket Case)
1188747682aSYipeng Wang---------------------------------------------------
119fc1f2750SBernard Iremonger
12027bd48ffSPablo de LaraThe hash table has two main tables:
12127bd48ffSPablo de Lara
1228747682aSYipeng Wang* First table is an array of buckets each of which consists of multiple entries,
1238747682aSYipeng Wang  Each entry contains the signature
1248747682aSYipeng Wang  of a given key (explained below), and an index to the second table.
12527bd48ffSPablo de Lara
12627bd48ffSPablo de Lara* The second table is an array of all the keys stored in the hash table and its data associated to each key.
12727bd48ffSPablo de Lara
1288747682aSYipeng WangThe hash library uses the Cuckoo Hash algorithm to resolve collisions.
12927bd48ffSPablo de LaraFor any input key, there are two possible buckets (primary and secondary/alternative location)
1308747682aSYipeng Wangto store that key in the hash table, therefore only the entries within those two buckets need to be examined
13127bd48ffSPablo de Larawhen the key is looked up.
1328747682aSYipeng WangThe Hash Library uses a hash function (configurable) to translate the input key into a 4-byte hash value.
1338747682aSYipeng WangThe bucket index and a 2-byte signature is derived from the hash value using partial-key hashing [partial-key].
13427bd48ffSPablo de Lara
1358747682aSYipeng WangOnce the buckets are identified, the scope of the key add,
1368747682aSYipeng Wangdelete, and lookup operations is reduced to the entries in those buckets (it is very likely that entries are in the primary bucket).
137fc1f2750SBernard Iremonger
1388747682aSYipeng WangTo speed up the search logic within the bucket, each hash entry stores the 2-byte key signature together with the full key for each hash table entry.
139fc1f2750SBernard IremongerFor large key sizes, comparing the input key against a key from the bucket can take significantly more time than
1408747682aSYipeng Wangcomparing the 2-byte signature of the input key against the signature of a key from the bucket.
1418747682aSYipeng WangTherefore, the signature comparison is done first and the full key comparison is done only when the signatures matches.
1428747682aSYipeng WangThe full key comparison is still necessary, as two input keys from the same bucket can still potentially have the same 2-byte signature,
143fc1f2750SBernard Iremongeralthough this event is relatively rare for hash functions providing good uniform distributions for the set of input keys.
144fc1f2750SBernard Iremonger
14527bd48ffSPablo de LaraExample of lookup:
14627bd48ffSPablo de Lara
14727bd48ffSPablo de LaraFirst of all, the primary bucket is identified and entry is likely to be stored there.
14827bd48ffSPablo de LaraIf signature was stored there, we compare its key against the one provided and return the position
14927bd48ffSPablo de Larawhere it was stored and/or the data associated to that key if there is a match.
15027bd48ffSPablo de LaraIf signature is not in the primary bucket, the secondary bucket is looked up, where same procedure
1518747682aSYipeng Wangis carried out. If there is no match there either, key is not in the table and a negative value will be returned.
15227bd48ffSPablo de Lara
15327bd48ffSPablo de LaraExample of addition:
15427bd48ffSPablo de Lara
1558747682aSYipeng WangLike lookup, the primary and secondary buckets are identified. If there is an empty entry in
1568747682aSYipeng Wangthe primary bucket, a signature is stored in that entry, key and data (if any) are added to
1578747682aSYipeng Wangthe second table and the index in the second table is stored in the entry of the first table.
15827bd48ffSPablo de LaraIf there is no space in the primary bucket, one of the entries on that bucket is pushed to its alternative location,
15927bd48ffSPablo de Laraand the key to be added is inserted in its position.
1608747682aSYipeng WangTo know where the alternative bucket of the evicted entry is, a mechanism called partial-key hashing [partial-key] is used.
1618747682aSYipeng WangIf there is room in the alternative bucket, the evicted entry
1628747682aSYipeng Wangis stored in it. If not, same process is repeated (one of the entries gets pushed) until an empty entry is found.
16327bd48ffSPablo de LaraNotice that despite all the entry movement in the first table, the second table is not touched, which would impact
16427bd48ffSPablo de Laragreatly in performance.
16527bd48ffSPablo de Lara
1668747682aSYipeng WangIn the very unlikely event that an empty entry cannot be found after certain number of displacements,
1678747682aSYipeng Wangkey is considered not able to be added (unless extendable bucket flag is set, and in that case the bucket is extended to insert the key, as will be explained later).
1688747682aSYipeng WangWith random keys, this method allows the user to get more than 90% table utilization, without
1698747682aSYipeng Wanghaving to drop any stored entry (e.g. using a LRU replacement policy) or allocate more memory (extendable buckets or rehashing).
17027bd48ffSPablo de Lara
171e605a1d3SHonnappa Nagarahalli
172e605a1d3SHonnappa NagarahalliExample of deletion:
173e605a1d3SHonnappa Nagarahalli
1748747682aSYipeng WangSimilar to lookup, the key is searched in its primary and secondary buckets. If the key is found, the
1758747682aSYipeng Wangentry is marked as empty. If the hash table was configured with 'no free on delete' or 'lock free read/write concurrency',
1768747682aSYipeng Wangthe position of the key is not freed. It is the responsibility of the user to free the position after
177769b2de7SDharmik Thakkarreaders are not referencing the position anymore. User can configure integrated RCU QSBR or use external RCU mechanisms to safely free the position on delete.
178e605a1d3SHonnappa Nagarahalli
1798747682aSYipeng Wang
1808747682aSYipeng WangImplementation Details (with Extendable Bucket)
1818747682aSYipeng Wang-------------------------------------------------
1828747682aSYipeng WangWhen the RTE_HASH_EXTRA_FLAGS_EXT_TABLE flag is set, the hash table implementation still uses the same Cuckoo Hash algorithm to store the keys into
1838747682aSYipeng Wangthe first and second tables. However, in the very unlikely event that a key can't be inserted after certain number of the Cuckoo displacements is
1848747682aSYipeng Wangreached, the secondary bucket of this key is extended
1858747682aSYipeng Wangwith a linked list of extra buckets and the key is stored in this linked list.
1868747682aSYipeng Wang
1878747682aSYipeng WangIn case of lookup for a certain key, as before, the primary bucket is searched for a match and then the secondary bucket is looked up.
1888747682aSYipeng WangIf there is no match there either, the extendable buckets (linked list of extra buckets) are searched one by one for a possible match and if there is no match
1898747682aSYipeng Wangthe key is considered not to be in the table.
1908747682aSYipeng Wang
1918747682aSYipeng WangThe deletion is the same as the case when the RTE_HASH_EXTRA_FLAGS_EXT_TABLE flag is not set. With one exception, if a key is deleted from any bucket
1928747682aSYipeng Wangand an empty location is created, the last entry from the extendable buckets associated with this bucket is displaced into
1938747682aSYipeng Wangthis empty location to possibly shorten the linked list.
1948747682aSYipeng Wang
1958747682aSYipeng Wang
19627bd48ffSPablo de LaraEntry distribution in hash table
19727bd48ffSPablo de Lara--------------------------------
19827bd48ffSPablo de Lara
19927bd48ffSPablo de LaraAs mentioned above, Cuckoo hash implementation pushes elements out of their bucket,
20027bd48ffSPablo de Laraif there is a new entry to be added which primary location coincides with their current bucket,
20127bd48ffSPablo de Larabeing pushed to their alternative location.
20227bd48ffSPablo de LaraTherefore, as user adds more entries to the hash table, distribution of the hash values
20327bd48ffSPablo de Larain the buckets will change, being most of them in their primary location and a few in
20427bd48ffSPablo de Laratheir secondary location, which the later will increase, as table gets busier.
20527bd48ffSPablo de LaraThis information is quite useful, as performance may be lower as more entries
20627bd48ffSPablo de Laraare evicted to their secondary location.
20727bd48ffSPablo de Lara
20827bd48ffSPablo de LaraSee the tables below showing example entry distribution as table utilization increases.
20927bd48ffSPablo de Lara
21027bd48ffSPablo de Lara.. _table_hash_lib_1:
21127bd48ffSPablo de Lara
21227bd48ffSPablo de Lara.. table:: Entry distribution measured with an example table with 1024 random entries using jhash algorithm
21327bd48ffSPablo de Lara
21427bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
21527bd48ffSPablo de Lara   | % Table used | % In Primary location | % In Secondary location |
21627bd48ffSPablo de Lara   +==============+=======================+=========================+
21727bd48ffSPablo de Lara   |      25      |         100           |           0             |
21827bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
21927bd48ffSPablo de Lara   |      50      |         96.1          |           3.9           |
22027bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
22127bd48ffSPablo de Lara   |      75      |         88.2          |           11.8          |
22227bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
22327bd48ffSPablo de Lara   |      80      |         86.3          |           13.7          |
22427bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
22527bd48ffSPablo de Lara   |      85      |         83.1          |           16.9          |
22627bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
22727bd48ffSPablo de Lara   |      90      |         77.3          |           22.7          |
22827bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
22927bd48ffSPablo de Lara   |      95.8    |         64.5          |           35.5          |
23027bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
23127bd48ffSPablo de Lara
23227bd48ffSPablo de Lara|
23327bd48ffSPablo de Lara
23427bd48ffSPablo de Lara.. _table_hash_lib_2:
23527bd48ffSPablo de Lara
23627bd48ffSPablo de Lara.. table:: Entry distribution measured with an example table with 1 million random entries using jhash algorithm
23727bd48ffSPablo de Lara
23827bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
23927bd48ffSPablo de Lara   | % Table used | % In Primary location | % In Secondary location |
24027bd48ffSPablo de Lara   +==============+=======================+=========================+
24127bd48ffSPablo de Lara   |      50      |         96            |           4             |
24227bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
24327bd48ffSPablo de Lara   |      75      |         86.9          |           13.1          |
24427bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
24527bd48ffSPablo de Lara   |      80      |         83.9          |           16.1          |
24627bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
24727bd48ffSPablo de Lara   |      85      |         80.1          |           19.9          |
24827bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
24927bd48ffSPablo de Lara   |      90      |         74.8          |           25.2          |
25027bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
25127bd48ffSPablo de Lara   |      94.5    |         67.4          |           32.6          |
25227bd48ffSPablo de Lara   +--------------+-----------------------+-------------------------+
25327bd48ffSPablo de Lara
25427bd48ffSPablo de Lara.. note::
25527bd48ffSPablo de Lara
25627bd48ffSPablo de Lara   Last values on the tables above are the average maximum table
25727bd48ffSPablo de Lara   utilization with random keys and using Jenkins hash function.
25827bd48ffSPablo de Lara
259fc1f2750SBernard IremongerUse Case: Flow Classification
260fc1f2750SBernard Iremonger-----------------------------
261fc1f2750SBernard Iremonger
262fc1f2750SBernard IremongerFlow classification is used to map each input packet to the connection/flow it belongs to.
263fc1f2750SBernard IremongerThis operation is necessary as the processing of each input packet is usually done in the context of their connection,
264fc1f2750SBernard Iremongerso the same set of operations is applied to all the packets from the same flow.
265fc1f2750SBernard Iremonger
266fc1f2750SBernard IremongerApplications using flow classification typically have a flow table to manage, with each separate flow having an entry associated with it in this table.
267fc1f2750SBernard IremongerThe size of the flow table entry is application specific, with typical values of 4, 16, 32 or 64 bytes.
268fc1f2750SBernard Iremonger
269fc1f2750SBernard IremongerEach application using flow classification typically has a mechanism defined to uniquely identify a flow based on
270fc1f2750SBernard Iremongera number of fields read from the input packet that make up the flow key.
271fc1f2750SBernard IremongerOne example is to use the DiffServ 5-tuple made up of the following fields of the IP and transport layer packet headers:
272fc1f2750SBernard IremongerSource IP Address, Destination IP Address, Protocol, Source Port, Destination Port.
273fc1f2750SBernard Iremonger
27448624fd9SSiobhan ButlerThe DPDK hash provides a generic method to implement an application specific flow classification mechanism.
275fc1f2750SBernard IremongerGiven a flow table implemented as an array, the application should create a hash object with the same number of entries as the flow table and
276fc1f2750SBernard Iremongerwith the hash key size set to the number of bytes in the selected flow key.
277fc1f2750SBernard Iremonger
278fc1f2750SBernard IremongerThe flow table operations on the application side are described below:
279fc1f2750SBernard Iremonger
280fc1f2750SBernard Iremonger*   Add flow: Add the flow key to hash.
281fc1f2750SBernard Iremonger    If the returned position is valid, use it to access the flow entry in the flow table for adding a new flow or
282fc1f2750SBernard Iremonger    updating the information associated with an existing flow.
283fc1f2750SBernard Iremonger    Otherwise, the flow addition failed, for example due to lack of free entries for storing new flows.
284fc1f2750SBernard Iremonger
285fc1f2750SBernard Iremonger*   Delete flow: Delete the flow key from the hash. If the returned position is valid,
286fc1f2750SBernard Iremonger    use it to access the flow entry in the flow table to invalidate the information associated with the flow.
287fc1f2750SBernard Iremonger
288e605a1d3SHonnappa Nagarahalli*   Free flow: Free flow key position. If 'no free on delete' or 'lock-free read/write concurrency' flags are set,
289e605a1d3SHonnappa Nagarahalli    wait till the readers are not referencing the position returned during add/delete flow and then free the position.
290e605a1d3SHonnappa Nagarahalli    RCU mechanisms can be used to find out when the readers are not referencing the position anymore.
291769b2de7SDharmik Thakkar    RCU QSBR process is integrated within the Hash library for safe freeing of the position. Application has certain responsibilities while using this feature.
292*41dd9a6bSDavid Young    Please refer to resource reclamation framework of :doc:`rcu_lib` for more details.
293e605a1d3SHonnappa Nagarahalli
294fc1f2750SBernard Iremonger*   Lookup flow: Lookup for the flow key in the hash.
295fc1f2750SBernard Iremonger    If the returned position is valid (flow lookup hit), use the returned position to access the flow entry in the flow table.
296fc1f2750SBernard Iremonger    Otherwise (flow lookup miss) there is no flow registered for the current packet.
297fc1f2750SBernard Iremonger
298fc1f2750SBernard IremongerReferences
299fc1f2750SBernard Iremonger----------
300fc1f2750SBernard Iremonger
301fc1f2750SBernard Iremonger*   Donald E. Knuth, The Art of Computer Programming, Volume 3: Sorting and Searching (2nd Edition), 1998, Addison-Wesley Professional
3028747682aSYipeng Wang* [partial-key] Bin Fan, David G. Andersen, and Michael Kaminsky, MemC3: compact and concurrent MemCache with dumber caching and smarter hashing, 2013, NSDI
303