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

Function table_lookup_unoptimized

dpdk/lib/table/rte_swx_table_em.c:400–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398}
399
400static int
401table_lookup_unoptimized(void *table,
402 void *mailbox __rte_unused,
403 uint8_t **key,
404 uint64_t *action_id,
405 uint8_t **action_data,
406 size_t *entry_id,
407 int *hit)
408{
409 struct table *t = table;
410 struct bucket_extension *bkt0, *bkt;
411 uint8_t *input_key;
412 uint32_t input_sig, bkt_id, i;
413
414 input_key = &(*key)[t->params.key_offset];
415
416 input_sig = t->params.hash_func(input_key, t->params.key_size, 0);
417 bkt_id = input_sig & (t->n_buckets - 1);
418 bkt0 = &t->buckets[bkt_id];
419 input_sig = (input_sig >> 16) | 1;
420
421 /* Key is present in the bucket. */
422 for (bkt = bkt0; bkt; bkt = bkt->next)
423 for (i = 0; i < KEYS_PER_BUCKET; i++)
424 if (bkt_keycmp(t, bkt, input_key, i, input_sig)) {
425 uint32_t bkt_key_id;
426 uint64_t *bkt_data;
427
428 /* Key. */
429 bkt_key_id = bkt->key_id[i];
430
431 /* Key data. */
432 bkt_data = table_key_data(t, bkt_key_id);
433 *action_id = bkt_data[0];
434 *action_data = (uint8_t *)&bkt_data[1];
435 *entry_id = bkt_key_id;
436 *hit = 1;
437 return 1;
438 }
439
440 *hit = 0;
441 return 1;
442}
443
444struct mailbox {
445 struct bucket_extension *bkt;

Callers 1

table_lookupFunction · 0.85

Calls 2

bkt_keycmpFunction · 0.85
table_key_dataFunction · 0.85

Tested by

no test coverage detected