MCPcopy Create free account
hub / github.com/F-Stack/f-stack / check_bucket

Function check_bucket

dpdk/app/test/test_hash_readwrite_lf_perf.c:194–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194static inline int
195check_bucket(uint32_t bkt_idx, uint32_t key)
196{
197 uint32_t iter;
198 uint32_t prev_iter;
199 uint32_t diff;
200 uint32_t count = 0;
201 const void *next_key;
202 void *next_data;
203
204 /* Temporary bucket to hold the keys */
205 uint32_t keys_in_bkt[8];
206
207 iter = bkt_idx * 8;
208 prev_iter = iter;
209 while (rte_hash_iterate(tbl_rwc_test_param.h,
210 &next_key, &next_data, &iter) >= 0) {
211
212 /* Check for duplicate entries */
213 if (*(const uint32_t *)next_key == key)
214 return 1;
215
216 /* Identify if there is any free entry in the bucket */
217 diff = iter - prev_iter;
218 if (diff > 1)
219 break;
220
221 prev_iter = iter;
222 keys_in_bkt[count] = *(const uint32_t *)next_key;
223 count++;
224
225 /* All entries in the bucket are occupied */
226 if (count == 8) {
227
228 /*
229 * Check if bucket was not scanned before, to avoid
230 * duplicate keys.
231 */
232 if (scanned_bkts[bkt_idx] == 0) {
233 /*
234 * Since this bucket (pointed to by bkt_idx) is
235 * full, it is likely that key(s) in this
236 * bucket will be on the shift path, when
237 * collision occurs. Thus, add it to
238 * keys_shift_path.
239 */
240 memcpy(tbl_rwc_test_param.keys_shift_path +
241 tbl_rwc_test_param.count_keys_shift_path
242 , keys_in_bkt, 32);
243 tbl_rwc_test_param.count_keys_shift_path += 8;
244 scanned_bkts[bkt_idx] = 1;
245 }
246 return -1;
247 }
248 }
249 return 0;
250}
251

Callers 1

generate_keysFunction · 0.85

Calls 2

rte_hash_iterateFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected