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

Function rte_efd_create

dpdk/lib/efd/rte_efd.c:493–715  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491}
492
493struct rte_efd_table *
494rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
495 uint64_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket)
496{
497 struct rte_efd_table *table = NULL;
498 uint8_t *key_array = NULL;
499 uint32_t num_chunks, num_chunks_shift;
500 uint8_t socket_id;
501 struct rte_efd_list *efd_list = NULL;
502 struct rte_tailq_entry *te;
503 uint64_t offline_table_size;
504 char ring_name[RTE_RING_NAMESIZE];
505 struct rte_ring *r = NULL;
506 unsigned int i;
507
508 efd_list = RTE_TAILQ_CAST(rte_efd_tailq.head, rte_efd_list);
509
510 if (online_cpu_socket_bitmask == 0) {
511 RTE_LOG(ERR, EFD, "At least one CPU socket must be enabled "
512 "in the bitmask\n");
513 return NULL;
514 }
515
516 if (max_num_rules == 0) {
517 RTE_LOG(ERR, EFD, "Max num rules must be higher than 0\n");
518 return NULL;
519 }
520
521 /*
522 * Compute the minimum number of chunks (smallest power of 2)
523 * that can hold all of the rules
524 */
525 if (max_num_rules % EFD_TARGET_CHUNK_NUM_RULES == 0)
526 num_chunks = rte_align32pow2(max_num_rules /
527 EFD_TARGET_CHUNK_NUM_RULES);
528 else
529 num_chunks = rte_align32pow2((max_num_rules /
530 EFD_TARGET_CHUNK_NUM_RULES) + 1);
531
532 num_chunks_shift = rte_bsf32(num_chunks);
533
534 rte_mcfg_tailq_write_lock();
535
536 /*
537 * Guarantee there's no existing: this is normally already checked
538 * by ring creation above
539 */
540 TAILQ_FOREACH(te, efd_list, next)
541 {
542 table = (struct rte_efd_table *) te->data;
543 if (strncmp(name, table->name, RTE_EFD_NAMESIZE) == 0)
544 break;
545 }
546
547 table = NULL;
548 if (te != NULL) {
549 rte_errno = EEXIST;
550 te = NULL;

Callers 8

test_add_deleteFunction · 0.85
test_add_update_deleteFunction · 0.85
test_efd_find_existingFunction · 0.85
test_five_keysFunction · 0.85
setup_keys_and_dataFunction · 0.85
create_efd_tableFunction · 0.85

Calls 15

strncmpFunction · 0.85
rte_zmallocFunction · 0.85
rte_zmalloc_socketFunction · 0.85
snprintfFunction · 0.85
rte_ring_createFunction · 0.85
rte_efd_freeFunction · 0.85
rte_ring_sp_enqueueFunction · 0.85
rte_freeFunction · 0.85
rte_align32pow2Function · 0.50

Tested by 7

test_add_deleteFunction · 0.68
test_add_update_deleteFunction · 0.68
test_efd_find_existingFunction · 0.68
test_five_keysFunction · 0.68
setup_keys_and_dataFunction · 0.68