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

Function table_create

dpdk/lib/table/rte_swx_table_wm.c:380–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378}
379
380static void *
381table_create(struct rte_swx_table_params *params,
382 struct rte_swx_table_entry_list *entries,
383 const char *args __rte_unused,
384 int numa_node)
385{
386 struct table *t = NULL;
387 size_t meta_sz, data_sz, total_size;
388 uint32_t entry_data_size;
389 uint32_t n_entries = count_entries(entries);
390
391 /* Check input arguments. */
392 if (!params || !params->key_size)
393 goto error;
394
395 /* Memory allocation and initialization. */
396 entry_data_size = 8 + params->action_data_size;
397 meta_sz = sizeof(struct table);
398 data_sz = n_entries * entry_data_size;
399 total_size = meta_sz + data_sz;
400
401 t = env_malloc(total_size, RTE_CACHE_LINE_SIZE, numa_node);
402 if (!t)
403 goto error;
404
405 memset(t, 0, total_size);
406 t->entry_data_size = entry_data_size;
407 t->total_size = total_size;
408 t->data = (uint8_t *)&t[1];
409
410 t->acl_ctx = acl_table_create(params, entries, n_entries, numa_node);
411 if (!t->acl_ctx)
412 goto error;
413
414 entry_data_copy(t->data, entries, n_entries, entry_data_size);
415
416 return t;
417
418error:
419 table_free(t);
420 return NULL;
421}
422
423struct mailbox {
424

Callers

nothing calls this directly

Calls 6

count_entriesFunction · 0.85
memsetFunction · 0.85
acl_table_createFunction · 0.85
entry_data_copyFunction · 0.85
env_mallocFunction · 0.70
table_freeFunction · 0.70

Tested by

no test coverage detected