41 static inline unsigned
48 while (
try < RTE_HASH_TSX_MAX_RETRY) {
49 status = rte_xbegin();
50 if (
likely(status == RTE_XBEGIN_STARTED)) {
54 for (i = 0; i < RTE_HASH_BUCKET_ENTRIES; i++) {
56 if (
likely(prim_bkt->key_idx[i] == EMPTY_SLOT)) {
57 prim_bkt->sig_current[i] = sig;
58 prim_bkt->sig_alt[i] = alt_hash;
59 prim_bkt->key_idx[i] = new_idx;
65 if (i != RTE_HASH_BUCKET_ENTRIES)
83 rte_hash_cuckoo_move_insert_mw_tm(
const struct rte_hash *h,
84 struct queue_node *leaf, uint32_t leaf_slot,
89 uint32_t prev_alt_bkt_idx;
91 struct queue_node *prev_node, *curr_node = leaf;
93 uint32_t prev_slot, curr_slot = leaf_slot;
95 while (
try < RTE_HASH_TSX_MAX_RETRY) {
96 status = rte_xbegin();
97 if (
likely(status == RTE_XBEGIN_STARTED)) {
99 if (curr_bkt->key_idx[curr_slot] != EMPTY_SLOT)
100 rte_xabort(RTE_XABORT_CUCKOO_PATH_INVALIDED);
101 while (
likely(curr_node->prev != NULL)) {
102 prev_node = curr_node->prev;
103 prev_bkt = prev_node->bkt;
104 prev_slot = curr_node->prev_slot;
107 = prev_bkt->sig_alt[prev_slot]
112 rte_xabort(RTE_XABORT_CUCKOO_PATH_INVALIDED);
119 curr_bkt->sig_alt[curr_slot] =
120 prev_bkt->sig_current[prev_slot];
121 curr_bkt->sig_current[curr_slot] =
122 prev_bkt->sig_alt[prev_slot];
123 curr_bkt->key_idx[curr_slot]
124 = prev_bkt->key_idx[prev_slot];
126 curr_slot = prev_slot;
127 curr_node = prev_node;
128 curr_bkt = curr_node->bkt;
131 curr_bkt->sig_current[curr_slot] = sig;
132 curr_bkt->sig_alt[curr_slot] = alt_hash;
133 curr_bkt->key_idx[curr_slot] = new_idx;
155 rte_hash_cuckoo_make_space_mw_tm(
const struct rte_hash *h,
161 struct queue_node queue[RTE_HASH_BFS_QUEUE_MAX_LEN];
162 struct queue_node *tail, *head;
169 tail->prev_slot = -1;
172 while (
likely(tail != head && head <
173 queue + RTE_HASH_BFS_QUEUE_MAX_LEN -
174 RTE_HASH_BUCKET_ENTRIES)) {
175 curr_bkt = tail->bkt;
176 for (i = 0; i < RTE_HASH_BUCKET_ENTRIES; i++) {
177 if (curr_bkt->key_idx[i] == EMPTY_SLOT) {
178 if (
likely(rte_hash_cuckoo_move_insert_mw_tm(h,
180 alt_hash, new_idx) == 0))
185 alt_bkt = &(h->
buckets[curr_bkt->sig_alt[i]
static void rte_pause(void)
struct rte_hash_bucket * buckets