New upstream version 18.08
[deb_dpdk.git] / lib / librte_hash / rte_cuckoo_hash.h
index 7a54e55..b43f467 100644 (file)
@@ -88,15 +88,14 @@ const rte_hash_cmp_eq_t cmp_jump_table[NUM_KEY_CMP_CASES] = {
 
 #endif
 
-enum add_key_case {
-       ADD_KEY_SINGLEWRITER = 0,
-       ADD_KEY_MULTIWRITER,
-       ADD_KEY_MULTIWRITER_TM,
-};
 
 /** Number of items per bucket. */
 #define RTE_HASH_BUCKET_ENTRIES                8
 
+#if !RTE_IS_POWER_OF_2(RTE_HASH_BUCKET_ENTRIES)
+#error RTE_HASH_BUCKET_ENTRIES must be a power of 2
+#endif
+
 #define NULL_SIGNATURE                 0
 
 #define EMPTY_SLOT                     0
@@ -155,18 +154,20 @@ struct rte_hash {
 
        struct rte_ring *free_slots;
        /**< Ring that stores all indexes of the free slots in the key table */
-       uint8_t hw_trans_mem_support;
-       /**< Hardware transactional memory support */
+
        struct lcore_cache *local_free_slots;
        /**< Local cache per lcore, storing some indexes of the free slots */
-       enum add_key_case add_key; /**< Multi-writer hash add behavior */
-
-       rte_spinlock_t *multiwriter_lock; /**< Multi-writer spinlock for w/o TM */
 
        /* Fields used in lookup */
 
        uint32_t key_len __rte_cache_aligned;
        /**< Length of hash key. */
+       uint8_t hw_trans_mem_support;
+       /**< If hardware transactional memory is used. */
+       uint8_t multi_writer_support;
+       /**< If multi-writer support is enabled. */
+       uint8_t readwrite_concur_support;
+       /**< If read-write concurrency support is enabled */
        rte_hash_function hash_func;    /**< Function used to calculate hash. */
        uint32_t hash_func_init_val;    /**< Init value used by hash_func. */
        rte_hash_cmp_eq_t rte_hash_custom_cmp_eq;
@@ -184,6 +185,7 @@ struct rte_hash {
        /**< Table with buckets storing all the hash values and key indexes
         * to the key table.
         */
+       rte_rwlock_t *readwrite_lock; /**< Read-write lock thread-safety. */
 } __rte_cache_aligned;
 
 struct queue_node {